Richard Lynch wrote: > 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. nevermind their diskspace, what about my bandwidth? - do I really need to cough up extra readies because some muppet refused to exchange his AOL connection for something resembling a proper ISP? granted yours is pragmatic solution to the problem but should we support shit ISPs, proxies and sunday-driver browser-wannabees with our/our-clients cash? feel free to ignore, it's late and I felt like playing devil's advocate. :-) > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php