RE: [PHP-WIN] image cache

From: Date: Wed, 24 Nov 2004 17:59:11 +0000
Subject: RE: [PHP-WIN] image cache
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-25042@lists.php.net to get a copy of this message
Here's a little trick that works for me $cur_time = time(); print "<img src='" . $file . "?" . $cur_time . "'>"; Since each time you load the page the image name will be different (since $cur_time will always change) the browser thinks the files are always different since the name changes - and thus you force a reload of the image. I do this on scripts that I make changes to images in PHP and need to see the new image after the page reloads instead of seeing the pre-processed image. (I also do something similar with JavaScript for webcam images to prevent caching) -M > i have an image upload script that uses fixed image names... > when i update an image, that image will be replaced at the > server using the same name as the old image... now, my > browser doesn't check for the new image but checkes it cache > instead and ofcourse finds the old image... how can i fix this? > i've allready added headers for not letting the page cache; > (<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE"> <META > HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">) > >

« previous php.windows (#25042) next »