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

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

 



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)
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">

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


[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