Re: Is it possible to stop an image from being cached?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Awesome, seems to work.  Thanks Tijnema!

- Dan

""Dan"" <frozendice@xxxxxxxxx> wrote in message news:E7.21.58452.85239A64@xxxxxxxxxxxxxxx
Well, this is only one specific image that constantly changes, the rest of the page is handled regularly.
From what you've said if I go with this
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past

That will effect only the one specific image I use this on when generating it right?

- Dan

"Tijnema" <tijnema@xxxxxxxxx> wrote in message news:d8269d910707261632k2d649476l102453e93eabf34d@xxxxxxxxxxxxxxxxx
On 7/27/07, Dan <frozendice@xxxxxxxxx> wrote:
Is this header you're refering to the header of the page which contains the
image, or the image itself?

- Dan

The image itself.

Also note, that if you use my solution 2, you still might get
problems, as the page that is calling might be cached, and in the
cached page, it refers to the image with the same unique code, and it
will use the cached image again.

Also, if you use solution 2, the image will still stay forever in the
temp folder of the browser(unless the user is cleaning it). If you use
solution 1, the browser will keep it only for this page, and will
remove it afterwards.

Tijnema

"Tijnema" <tijnema@xxxxxxxxx> wrote in message
news:d8269d910707261527o7ac08edap61802a712fbac7da@xxxxxxxxxxxxxxxxx
> On 7/27/07, brian <phplist@xxxxxxxxxxxxxxx> wrote:
>> Tijnema wrote:
>> > On 7/26/07, Dan <frozendice@xxxxxxxxx> wrote:
>> >
>> >> I 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
>> >
>> >
>> > Solution 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');
>>
>> brian
>
> 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.info

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux