>How does IE6 control the display of images?
I change the content of a image file image1.jpg without changing the file
name. Then jump to a new page to display it.
What happens if you use the following .htaccess commands
so they apply to the image (not the file with the <img src=...>):
(I'm assuming the server is Apache; I don't know how to get the
equivalent out of other servers):
ExpiresActive On
ExpiresByType image/jpeg "access plus 1 second"
I don't think Apache will accept "access minus 1 year". I'm not
sure about "access plus 0 seconds".
The idea here is that you get the headers on the IMAGE, not on the
page with the <img src= ...> in it.
IE6 does not displays the original picture, not the new image.
If it doesn't display the original picture, and it doesn't
display the new image, what DOES it do?
Where is IE6 getting the info (image1.jpg) for the picture?
Probably out of its cache.
How do I force IE6 to display the new picture?
How about this: create a new file image1.php, which outputs
headers and then outputs the image file. Change your references
to image1.jpg to image1.php in other pages.
<?php
header("Content-type: image/jpeg");
header("Content-length: " . filesize("image1.jpg"));
header("Expires: 1 Jan 1990 00:00:00 GMT");
header("Pragma: no-cache");
header("Cache-control: no-cache, no-store, must-revalidate");
header("Cache-control: pre-check=0,post-check=0", false);
... more headers here if desired ...
$fp = fopen("image1.jpg", "rb");
fpassthru($fp);
exit;
?>
Most of the stuff above is derived from the PHP site description
of the header() and fpassthru() functions.
If you are generating an image that is specific to the user, for
example, a graph of how HIS stock portfolio is doing, I'd recommend
NOT saving the image in a file, just generate and output it
when the image1.php file is called. It does reduce problems if
there are multiple users all looking at the same pages (but expecting
to see THEIR data in them) at the same time. If, on the other hand,
this image is something that stays the same for everyone (e.g.
a graph of a well-known stock market index) it may not be an issue.
This technique is reportedly used by pay sites also, except that the
PHP doesn't necessarily add headers, it validates your login instead
and directs you to a login/signup page if you aren't logged in.
Gordon L. Burditt