Image Cache

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
scts102
Forum Newbie
Posts: 23
Joined: Thu Aug 25, 2005 2:15 pm

Image Cache

Post by scts102 »

I am using GD to place text on an existing image. This works fine.

However, each time the image is called, a server is queried...Now, this image may appear on many pages, so I would only want the image to update every 5 or 10 minutes. How can I implement a cache?

I read something about headers and expiring, but I am inexperienced with web development. Could someone write a quick example of how to cache the image, and refresh it every X minutes?

Thanks,
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Why not just save the images to a temp folder and then run a cron job to delete the images after x amount of time.
scts102
Forum Newbie
Posts: 23
Joined: Thu Aug 25, 2005 2:15 pm

Post by scts102 »

Okay...that sounds doable

How do I save the dynamic image to a file?
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Post Reply