Forum Moderators: coopster

Message Too Old, No Replies

Caching thumbnail generated images

         

asantos

4:36 am on Jun 21, 2006 (gmt 0)

10+ Year Member



Hi, im using a image thumbnailer
[foo.com...]

I have two questions

1) How could i save the printed image in the cache so that it loads faster next time?

2) Does it get cached by the visitor's browser too?

mcavic

5:36 am on Jun 21, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



After the php script creates the thumbnail, it can save a copy of it in a cache directory. Whenever the script is called, check to see if there's a copy of the correct thumbnail in the cache, and if so, just show that file instead of resizing.

This method won't save you any bandwidth, but it'll save a little bit of CPU time on the server.

Images generated by a php script aren't usually cached by the browser. But if you want it to, it might be possible [google.com].

eeek

5:57 am on Jun 21, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



How could i save the printed image in the cache so that it loads faster next time?

Write it to a file. Then check if the file exists and send the file when you get another request for the same image.

Does it get cached by the visitor's browser too?

With the query string in your URL it might not be cached.

[edited by: jatar_k at 8:38 am (utc) on June 21, 2006]
[edit reason] fixed post [/edit]