Re: Dynamic Images

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

 



On Wed, August 2, 2006 7:38 am, Manoj Singh wrote:

> I am creating a a script in which a dynamic graph is generated through
> gd
> library. The format of the picture is jpeg. Now the problem is that
> the
> browser is caching the images and after updating also it is displaying
> the
> older image.
>
> Currently for clearing the cache i am using this code
> <?php
> header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
> header("Cache-Control: no-store, no-cache, must-revalidate");
> header("Cache-Control: no-cache");
> header("Pragma: no-cache");
> ?>
>
> But this code is not working me. Please help me.

Unfortunately, all the headers in the world won't fix ALL the
browsers, because there is always somebody (browser or intermediary
caching server like AOHell) that thinks they know better than you when
to cache an image.

You'll spend hours "fixing" this with different headers, and it will
work in all your browser tests, and then somebody using Fred's
Warehouse Browser" will send in a bug report that your site is
"broken"

Also note that only the SECOND Cache-Control: header is being sent by
PHP unless you use the optional second arg to ask PHP to send both:
http://php.net/header

The best solution to this is to change your IMG tag to have a random
number in it, so that the cached image is never the same URL, so it
never gets used.

Stupid, I know, and wasteful of the browser cache disk space, but
there it is.  It works.

-- 
Like Music?
http://l-i-e.com/artists.htm

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