Dynamic images and browser caches

Hi!

I run an adoptable pet website, PixelWoods. Users can adopt pets that grow with clicks, basically. I’m trying to write a script to allow them to choose hats to put on said pets and everything works except for the problem I’ll describe shortly.

Each pet is stored in a different row and has a unique id. Users are given a BBCode for each that looks something like this (in this example the pet has an id of 123):

[img]http://www.pixelwoods.com/get/123.gif[/img]

The problem is that the image doesn’t update unless you refresh the page. So swapping hats does nothing until the dynamic image is refreshed. I can only assume that the browser has a cache of the image which it prefers over the new image.

The process for getting a pet’s image for a pet with the id 123 is like this:

Image link users use to display their pet ( pixelwoods.com/get/123.gif )
.htaccess redirects to pixelwoods.com/image_b.php, which compiles image and saves to a server-side cache.
image_b.php redirects (via header tag) to the cached image

I assume my browser only gets as far as /get/123.gif and pulls its cached image of it out - is there any way around this? One that doesn’t involve the user having to update their image link.

Any direction is much appreciated!

You would need to look in to ajax

Sponsor our Newsletter | Privacy Policy | Terms of Service