New image already cached.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi gang:

I wrote a program that presents a bunch of thumbnails to the users. When the user wants to view a larger version of one of the thumbnails, s/he simply clicks the thumbnail and another page is displayed with the larger image -- nothing new there.

However, considering that the larger image is copyrighted, the client wanted a copyright printed across the image, but not on the thumbnail (too small to worry about and it distracted from the small image).

So, my code takes two images, merges them (i.e., the large version with a copyright) and then presents the new image to the browser via a link. It sounded good and works in Safari and FireFox.

Unfortunately, not all browsers treat an image link in the same manner. For example, Safari and FireFox treats the link "/images/merged.png" as a new image every time. Unfortunately, Opera and some other browsers cache the first image and every time after that, the same large image is shown regardless of the thumbnail. In other words, they treat the link "/images/merged.png" as it has the same image each time, when it doesn't.

So, I have several options to solve this, but I was wondering if there was a way to force a browser not to cache images?

I tried using this:

// expires on any past date
header ("Expires: Mon, 26 Jul 1997 05:00: GMT");

// last modified at current date and time
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");

// for HTTP 1.1:
header ("Cache-Control: no-store, no-cache, must-revalidate");
header ("Cache-Control: post-check=0, pre-check=0", false);

// for HTTP 1.0
header ("Pragma: no-cache");

However, it works only IF the user refreshes their browser.

Any ideas before I jump back into this?

Thanks.

tedd
--
--------------------------------------------------------------------------------
http://sperling.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux