Page 1 of 1

Generated image caching problem in IE

Posted: Tue Sep 09, 2008 8:19 am
by sweb
hails ...

i have generated the picture with gd2 in php 5 but i have a problem. i want the generated image cache in browser and just reload it from server that user press F5 to relative another time from server. i is this header :

Code: Select all

 
    header("Cache-Control: maxage=2592000, public, must-revalidate, post-check=0, pre-check=0");
    header("Pragma: public");
    header("Expires: 0");
    header("Content-type: image/jpeg");
 
in opera and great firefox caching is ok but in damned IE the images every time requested from server.

what must i do?

Re: Generated image caching problem in IE

Posted: Tue Sep 09, 2008 8:23 am
by marcth
As an initial step, try changing the header("Expires: 0"); to an expire date in the future.

Re: Generated image caching problem in IE

Posted: Tue Sep 09, 2008 8:31 am
by panic!
quick hack:

add a query string with a random number on the end


<img src="image.jpg?cache=<?=rand(0,99999);?>" alt="get ya cache out" />

Re: Generated image caching problem in IE

Posted: Tue Sep 09, 2008 8:42 am
by onion2k
panic! wrote:quick hack:

add a query string with a random number on the end


<img src="image.jpg?cache=<?=rand(0,99999);?>" alt="get ya cache out" />
He wants the image to cache. That would stop it caching.

Re: Generated image caching problem in IE

Posted: Tue Sep 09, 2008 8:44 am
by panic!
hahaha.
whoops!

sorry I should try reading posts once in a while..

Re: Generated image caching problem in IE

Posted: Tue Sep 09, 2008 1:10 pm
by Darkzaelus
This would just be a problem with IE. IE isn't noted for its image caching abilities...
But don't start complaining until you have rollovers *shiver*

Cheers, Darkzaelus