I am attempting to implement a script that will retrieve a file, create a thumbnail image, and write the thumbnail to the "Response.OutputStream". The thing is that I don't think that such a thing exists in PHP and so I'm a bit lost.
How do I write the file (as bytes) directly to the response?
This is what I have so far....
Expand|Select|Wrap|Line Numbers
- // load image and get image size
- $img = imagecreatefromjpeg( "{$pathToImages}{$fname}" );
- $width = imagesx( $img );
- $height = imagesy( $img );
- // calculate thumbnail size
- $new_width = $thumbWidth;
- $new_height = floor( $height * ( $thumbWidth / $width ) );
- // create a new temporary image
- $tmp_img = imagecreatetruecolor( $new_width, $new_height );
- // copy and resize old image into new image
- imagecopyresized( $tmp_img, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height );
- // save thumbnail into a file
- //imagejpeg( $tmp_img, "{$pathToThumbs}{$fname}" );
- //>>> Here I want to save the file to the to the output stream <<<
Thanks
-Frinny