Problem: A picture is updated on the server - the picture itself is changed but not the picture name. But the browsers (diferent locations, different computers, different OS, trying both IE / Netscape) - display the old image until refresh clicked or F5 key is pressed. Already tried <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE"> <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"> <META HTTP-EQUIV="Expires" CONTENT="-1"> Header("Cache-Control: max-age=1, must-revalidate, no-store"); $expire = "Expires: " . gmdate("D, d M Y H:i:s", time()) . " GMT"; Header($expire); Is there anyone clever enough to solve this one??
already have the whole set of those... session_cache_expire( 0 ); session_cache_limiter( "nocache" ); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); doesn't seem to help
there is no script really... I want to keep the main page w/o any SQL queries... every 15 mintues I'll run a script that copies a picture from from top list and latest pictures list to another picture, ie "femalelast.jpg" etc there is static link on the main page, for example: <td width=125 align="center" valign="middle"> <?php echo "<a href='lastpic.php?mode=female'>"; ?> <img src="/sp/femalelast.jpg" hspace=2 vspace=2><BR> <b>Women</b></a><BR> </td> (don't ask why I have got the PHP in the middle... probably copy-pasted something when I wrote this and then made some changes or whatever. not relevant I guess in any case) the script that copies the picture (in a special PHP page) is simple while ($l = mysql_fetch_array($result, MYSQL_ASSOC)) { $fromcopy = "/th/t" . $l['pic']; unlink ("/sp/femalelast.jpg"); copy ($fromcopy,"/sp/femalelast.jpg"); } This worked for 3 months, ad stopped working a week ago.... (the unlink was added yesterday, no help though)
ok.. now i see what you mean... so now I am using echo "<img src='/sp/femalelast.jpg?" . time() . "' hspace=2 vspace=2><BR>"; this will force a reload - seems that I will lose any cache ability.... but at least the picture is up to date... ... umm guess you can't have both... now I can get rid of the header and HTTP-EQUIV stuff as well
Well, unless you'd be holding a flag somewhere that indicates whether the image has been changed since it was last loaded to the user's browser, you'd have to choose between caching or reloading. In this case, reloading seems to be the best option.