I have one image on my website that I don't want cached. The image is used as a background in CSS so I can not change it's name dynamically. Any ideas ?
Another alternative would be to add a random string after your image file.
<img src="/path/to/image/image.jpg?<?php echo time(); ?>/>
This should ensure that the image is reloaded each time the page is displayed.
mnot has a good caching tutorial that will explain how to set the HTTP headers to request that the image is not cached (remember, you need to set the HTTP headers for the image, not the HTML document).
This is probably a bad idea though as images tend to be relatively chunky, so redownloading it for every page could impose a significant performance slow down.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With