RE: [PHP] Is it possible to stop an image from being cached?
| From: | Chris Aitken | Date: | Thu, 26 Jul 2007 22:16:08 +0000 |
| Subject: | RE: [PHP] Is it possible to stop an image from being cached? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-259604@lists.php.net to get a copy of this message | ||
> Solution 1:
> Send a header() that avoids caching (can't remember it exactly)
> Solution 2:
> Call the image like this:
> <img src="image.jpg?arandomstringhereeachtime">
> Or if you were creating it with a php script:
> <img src="image.php?img=image.jpg&arandomstringhereeachtime">
My preferred way of doing it, and making sure its reloaded each time is to
do it this way... the U variable pretty much guarantees a random string each
time its loaded.
image.jpg?".date("U")."
Regards
Chris Aitken
The Web Hub Designer and Programmer
Phone : 02 4648 0808
Mobile : 0411 132 075
-------------------------------------------------
Making The Web Work........ The Web Hub
http://www.thewebhub.com.au/
chris@thewebhub.com.au
-------------------------------------------------
Confidentiality Statement:
This message is intended only for the use of the Addressee and may contain
information that is PRIVILEDGED and CONFIDENTIAL. If you are not the
intended recipient, dissemination of this communication is prohibited.
If you have received this communication in error, please erase all
copies of the message and its attachments and notify us immediately.