I am new to php. I am able to use a form for the user to input/upload a jpeg image and I can save it to a mysql database and bring it back later and display it.
I can't seem to do that with thumbnails.
I can create a thumbnail with imagecreatefromstring on the original uploaded file and then I use imagecreatetruecolor and then imagecopyresized. If I use imagejpeg to save it to disk it works great.
What I am trying to do is use imagejpeg with output to a browser and capture that output in a var that I can store in a database.
Here is the code:
$dest_img = imagecreatetruecolor($dest_width, $dest_height)
or die("Cannot Initialize new GD image stream");
imagecopyresized( $dest_img, $src_image, 0, 0, 0, 0, $dest_width, $dest_height, $width, $height)
or die("Cannot Resize the image."); // resize the image
ob_start(); // Start capturing stdout.
imageJPEG($dest_img); // As though output to browser.
$Thumbnail = ob_get_contents();
ob_end_clean(); // Dump the stdout so it does not screw other output.
Is this the best/only way to get it into a var?
It is not working. I would like to just put in a var without having to send it to a browser and cature the output buffer.
Any ideas would be greatly appreciated.
TIA