Not entirely sure I understand your requirements... but why do you need to disable caching at all? As long as each image is corresponding to a unique URL, things should work as intended. Let's assume you have three images. So, instead of having something like
----- ---------- --------- ----------- ----- | <-- | | left.jpg | | mid.jpg | | right.jpg | | --> | ----- ---------- --------- ----------- -----
and then changing the image content that's delivered as "left.jpg" etc. when the --> button is clicked, it's proably easier to just update/rotate the URLs. For example, if you initially have
then, after rotation, you'd output----- ---------- --------- ----------- ----- | <-- | | img1.jpg | | img2.jpg | | img3.jpg | | --> | ----- ---------- --------- ----------- -----
----- ---------- --------- ----------- ----- | <-- | | img2.jpg | | img3.jpg | | img4.jpg | | --> | ----- ---------- --------- ----------- -----
i.e. "img2.jpg" remains the same image (so the browser can reload it from its cache). It'll just be displayed in a different place.
Even if your requirements are not quite as simple as that, it should still be possible to always make sure that, if the content of the image changes, it gets a new URL (so cache lookup will surely fail). At least, that approach should always work as a last resort. But maybe I've completely misunderstood what you want to do... :)
Having said that, if you still want to go the other route trying to disable client side caching, you might want to look into using mod_headers, which lets you set/add specific custom headers for certain URLs, even if they're static, like images.
BTW, there's a neat caching test page (AJAX-based), to give you an idea of which caching features actually do work in current browsers... (things have gotten better, generally, but there are still a number of more sophisticated, unresolved issues)
In reply to Re: Slightly OT: Stop caching images
by almut
in thread Slightly OT: Stop caching images
by astroboy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |