On Mon, May 23, 2005 8:46 am, Rahul S. Johari said: > If I had misunderstood your method and you think your method is better > then > what I'm using now, I'd still really appreciate if you can clarify and > explain.
Your method is fine. In fact, it penalizes IE for some stupidity in its caching, which is Good because maybe they'll fix it if their cache becomes increasingly useless as everybody does this to avoid their stupid bugs. In theory, the ?$random_string should have forced the browser to load a new/different image each time... It's hard to imagine even Microsoft could screw that up, but you never know with Microsoft on this issue... One possible improvement, however, is this: The random part of the URL that you need to use to make Microsoft *NOT* cache an image doesn't have to be tied to the actual algorithm that creates the image. Consider this example: ---- index.html --- <?php $fool_microsoft = mt_rand(1, 2000000); ?> <img src="random.php/<?php echo $fool_microsoft?>/example.png> ------------------- ---- random.php --- <?php $heads = mt_rand(0, 1) ? 'heads' : 'tails'; $image = imagecreatetruecolor(100, 100); $white = imagecolorallocate($image, 255, 255, 255); $black = imagecolorallocate($image, 0, 0, 0); imagefilledrectangle($image, 0, 0, 100, 100, $white); imagestring($image, $heads, 10, 60, $black); header("Content-type: image/png"); imagepng($image); ?> The HUGE random number in the URL that forces MS to never cache my coin-flipping image has nothing to do with the heads/tails outcome. I don't know if this will help you have less clutter in your images or not, but it might be useful some day. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php