I’m writing a simple site for our local Boy Scout troop, which should allow image upload.
I’m using PHP 4.3.9 to resize the images and create thumbnails, but the (donated) hosting service
does not allow file system writes from PHP. They do, however, provide 5G of mysql. I would like to
store the images in the database, but have not found a way to convert the resized images to JPEG. As far as i can tell, imagejpg will only write to a file (which i can’t do). Does
anyone know if it is possible to generate a JPEG to memory in PHP?
Thanks!
-jim
I’m writing a simple site for our local Boy Scout troop, which should allow
Share
You can use output buffering:
To clarify, if you look at the manual for imagejpeg, you’ll see that you can use it to either write to a file or output the raw image stream directly, depending on the second parameter. I am using output buffering to capture that raw image stream.