开发者

How can we Dyanamic Images Produced from Database using Zend Framework

开发者 https://www.devze.com 2023-03-20 17:56 出处:网络
Problem: I could not find a proper/working info googling about caching dyanamic images, as per my requirement.

Problem:

I could not find a proper/working info googling about caching dyanamic images, as per my requirement.

I am using Zend Framework and url of the images looks like http://localhost/media/image/id/1120. The images are stored in the database.

Is there any way I can cache my images.

One of the Resouce Looked at: http://dtbaker.com.au/random-bits/how-to-cache-images-generated-by-php.html

This is the closet I could get and the images are cached开发者_JS百科 in this website but can't make it work on situation like mine.

A help would be great.


If you are using Zend Framework, then your first port of call for caching anything should be Zend_Cache.

Having said that, caching images is probably the easiest caching problem to solve as it is just a matter of saving a local copy of any image to your server after it is generated and checking for a local copy before running the code that generates it.

Something like:-

if(file_exists(image12345.png){
    serve cached file;
} else {
    generate new file;
    save new file to image12345.png;
    serve cached file;
}

Looking at your user name you should be able to work out real, working code for yoursel(f)(ves).

0

精彩评论

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

关注公众号