Re: Is it possible to stop an image from being cached?
| From: | Tijnema | Date: | Thu, 26 Jul 2007 22:27:28 +0000 |
| Subject: | Re: Is it possible to stop an image from being cached? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-259607@lists.php.net to get a copy of this message | ||
On 7/27/07, brian <phplist@subtropolix.org> wrote:
Tijnema wrote: On 7/26/07, Dan <frozendice@gmail.com> wrote:That's HTTP/1.1 only, but this is what I got from PHP site: <?php header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past ?> Tijnema -- Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.infoSolution 1: Send a header() that avoids caching (can't remember it exactly) You can try: header('Cache-Control: no-store, no-cache, must-revalidate, Post-Check=0, Pre-Check=0'); brianI have a situation where there is a single image let's call it somebody.jpg. I want to be able to dynamicly create this image using php, basicilly I have PHP set to handle .jpg files also, so I then go through and create an image based upon some info I get from a database call and then use header('Content-Type: image/jpeg'); passthru($file); to send the image to the user. My problem is once they view the image their browser "helpfully" caches it so they don't have to download it again. Is there any tactic short of changing the name constantly of the image to avoid browser caching of an image? - Dan