I have a PHP script that renders an image from another image using PHP GD Library. I need to know what is the most effective solution (what is the best way):
1.Render the image “on the fly” like this:
<img src="createImage.php=id=1" />
OR:
2.Render/create the image while uploading the first image, and then store it in a database?
<img src="$image" />
Please post a link to your source if you have any 🙂
It is faster to Render/create the image while uploading the first image, and store it NOT IN THE DATABASE (!!!), but in the filesystem!!! Refrain from using BLOBs for this purpose, it is unnecessary overhead. Moreover, files are much easier to backup than a huge database full of blobs.
So the second possibility is right, but use the filesystem. I’d call this technique “caching”.