Generated image caching problem in IE

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sweb
Forum Newbie
Posts: 18
Joined: Tue Oct 30, 2007 6:32 am
Location: Iran (Semnan)

Generated image caching problem in IE

Post 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?
marcth
Forum Contributor
Posts: 142
Joined: Mon Aug 25, 2008 8:16 am

Re: Generated image caching problem in IE

Post by marcth »

As an initial step, try changing the header("Expires: 0"); to an expire date in the future.
User avatar
panic!
Forum Regular
Posts: 516
Joined: Mon Jul 31, 2006 7:59 am
Location: Brighton, UK

Re: Generated image caching problem in IE

Post 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" />
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: Generated image caching problem in IE

Post 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.
User avatar
panic!
Forum Regular
Posts: 516
Joined: Mon Jul 31, 2006 7:59 am
Location: Brighton, UK

Re: Generated image caching problem in IE

Post by panic! »

hahaha.
whoops!

sorry I should try reading posts once in a while..
Darkzaelus
Forum Commoner
Posts: 94
Joined: Tue Sep 09, 2008 7:02 am

Re: Generated image caching problem in IE

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