开发者

PHP GD Library, rendering an image - saving the image or not (what is the most effective solution)?

开发者_Python百科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".


2 - Is the better option. You minimize server resource consumption, but as Tomas pointed out store it in a directory rather than in the database, its easier and faster to access.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜