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
sweb
Forum Newbie
Posts: 18 Joined: Tue Oct 30, 2007 6:32 am
Location: Iran (Semnan)
Post
by sweb » Tue Sep 09, 2008 8:19 am
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
Post
by marcth » Tue Sep 09, 2008 8:23 am
As an initial step, try changing the header("Expires: 0"); to an expire date in the future.
panic!
Forum Regular
Posts: 516 Joined: Mon Jul 31, 2006 7:59 am
Location: Brighton, UK
Post
by panic! » Tue Sep 09, 2008 8:31 am
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" />
onion2k
Jedi Mod
Posts: 5263 Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com
Post
by onion2k » Tue Sep 09, 2008 8:42 am
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.
panic!
Forum Regular
Posts: 516 Joined: Mon Jul 31, 2006 7:59 am
Location: Brighton, UK
Post
by panic! » Tue Sep 09, 2008 8:44 am
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
Post
by Darkzaelus » Tue Sep 09, 2008 1:10 pm
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