By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,286 Members | 2,422 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,286 IT Pros & Developers. It's quick & easy.

Image not refreshing

P: n/a
Ken
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.

IE6 does not displays the original picture, not the new image.

If I press F5, the correct image is displayed.

I tried:

session_cache_limiter('nocache');
session_start();
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header ("Last-modified: ".gmdate("D, dMYH: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");

with no success.

The echoed file name is correct.
The file on the server has the correct picture (content).

Where is IE6 getting the info (image1.jpg) for the picture?

How do I force IE6 to display the new picture?

Is there a PHP command that simulate pressing F5?

Ken

How do I force IE6
Jul 17 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
*** Ken escribió/wrote (Thu, 16 Sep 2004 17:45:23 GMT):
session_cache_limiter('nocache');
session_start();
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header ("Last-modified: ".gmdate("D, dMYH: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");

with no success.
These headers only apply to the document in which you use them. Do you
generate pictures with a PHP script?
Where is IE6 getting the info (image1.jpg) for the picture?


Supposedly, from the web server response headers, given that it's
configured to check if the file has changed. You can find out in "Internet
Options-> Temporaty Internet Files-> Configuration"

--
-+ Álvaro G. Vicario - Burgos, Spain
+- http://www.demogracia.com (la web de humor barnizada para la intemperie)
++ Las dudas informáticas recibidas por correo irán directas a la papelera
-+ I'm not a free help desk, please don't e-mail me your questions
--
Jul 17 '05 #2

P: n/a
Ken
"Alvaro G. Vicario" <kA*****************@terra.es> wrote in message
news:15*****************************@40tude.net...
*** Ken escribió/wrote (Thu, 16 Sep 2004 17:45:23 GMT):
session_cache_limiter('nocache');
session_start();
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header ("Last-modified: ".gmdate("D, dMYH: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");

with no success.
These headers only apply to the document in which you use them.

I added the above script to the page which displays the pictures with no
success.
Do you generate pictures with a PHP script? PHP handles the picture input and conversion (picture9 to new_file_name) to
a different name.
<input type=file size=65 name="picture9" Id="pt9">
<img src="<?php echo $_SESSION['new_file_name'];?> " border="0" width="100">
Supposedly, from the web server response headers, given that it's configured to check if the file has changed.
Is the image file name part of the web server response header or does the
header force the webpage to look else where for the actual file. The actual
file on the server has the correct content, but IE is not requesting an
update since the file name has not changed.

Is the web server making the determination if the file has changed?
Should I be looking for commands for the web server?
or
Is the browser making the determination?
Should I be look for commands for the browser?

Are there commands to control the web server response?
You can find out in "Internet Options-> Temporary Internet Files->

Configuration"

My computer is set for automatic. If I set it for "every visit to page" the
picture display properly.

Unfortunately, I cannot change the selected setting on the web page viewers.
So I am looking for a PHP command to force the page to "Check for newer
version of stored page for each visit".

Can this be done?

Ken
Jul 17 '05 #3

P: n/a
*** Ken escribió/wrote (Thu, 16 Sep 2004 19:38:47 GMT):
Do you generate pictures with a PHP script? PHP handles the picture input and conversion (picture9 to new_file_name) to
a different name.
<input type=file size=65 name="picture9" Id="pt9">
<img src="<?php echo $_SESSION['new_file_name'];?> " border="0" width="100">


Pictures aren't embedded in HTML documents, they're simply linked. If you
tell the browser that current HTML file expires, that won't affected linked
files.
My computer is set for automatic. If I set it for "every visit to page" the
picture display properly.
Then the web server is configured correctly.
Unfortunately, I cannot change the selected setting on the web page viewers.
So I am looking for a PHP command to force the page to "Check for newer
version of stored page for each visit".


I can't understand why you need to change pictures in the middle of the
browsing session. The simpliest solution that may work is adding a random
parameter to each link:

<img src="picture.jpg?foo=<?=$random_string?>">
--
-+ Álvaro G. Vicario - Burgos, Spain
+- http://www.demogracia.com (la web de humor barnizada para la intemperie)
++ Las dudas informáticas recibidas por correo irán directas a la papelera
-+ I'm not a free help desk, please don't e-mail me your questions
--
Jul 17 '05 #4

P: n/a
>My computer is set for automatic. If I set it for "every visit to page" the
picture display properly.


I've seen the same problem, and it appears to be IE that causes the
problems. I haven't seen the same problems with Firefox.

I guess this is one of those cases where you have to remember that
Microsoft stopped developing IE in 2002, and we should all be telling
the world to use FireFox instead...
Jonathan Beckett (jo********@pluggedout.com)
working on : http://www.pluggedout.com/penpals
Jul 17 '05 #5

P: n/a
>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
Jul 17 '05 #6

P: n/a
Ken
"Alvaro G. Vicario" <kA*****************@terra.es> wrote in message
news:1n*****************************@40tude.net...
*** Ken escribió/wrote (Thu, 16 Sep 2004 19:38:47 GMT):
Do you generate pictures with a PHP script? PHP handles the picture input and conversion (picture9 to new_file_name) to a different name.
<input type=file size=65 name="picture9" Id="pt9">
<img src="<?php echo $_SESSION['new_file_name'];?> " border="0" width="100">
Pictures aren't embedded in HTML documents, they're simply linked. If you
tell the browser that current HTML file expires, that won't affected linked files.
My computer is set for automatic. If I set it for "every visit to page"
the picture display properly.


Then the web server is configured correctly.
Unfortunately, I cannot change the selected setting on the web page viewers. So I am looking for a PHP command to force the page to "Check for newer
version of stored page for each visit".


I can't understand why you need to change pictures in the middle of the
browsing session. The simpliest solution that may work is adding a random
parameter to each link:

<img src="picture.jpg?foo=<?=$random_string?>">
--
-+ Álvaro G. Vicario - Burgos, Spain
+- http://www.demogracia.com (la web de humor barnizada para la

intemperie) ++ Las dudas informáticas recibidas por correo irán directas a la papelera
-+ I'm not a free help desk, please don't e-mail me your questions


Thanks Alvaro,

This worked.

Great idea.

Ken
Jul 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.