Image not refreshing

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ken

    #1

    Image not refreshing

    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_l imiter('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


  • Alvaro G. Vicario

    #2
    Re: Image not refreshing

    *** Ken escribió/wrote (Thu, 16 Sep 2004 17:45:23 GMT):[color=blue]
    > session_cache_l imiter('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.[/color]

    These headers only apply to the document in which you use them. Do you
    generate pictures with a PHP script?
    [color=blue]
    > Where is IE6 getting the info (image1.jpg) for the picture?[/color]

    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
    --

    Comment

    • Ken

      #3
      Re: Image not refreshing

      "Alvaro G. Vicario" <kAlvaroNOSPAMT HANKS@terra.es> wrote in message
      news:15yp0qfjgz qgc.9t20mnue9lf 2$.dlg@40tude.n et...[color=blue]
      > *** Ken escribió/wrote (Thu, 16 Sep 2004 17:45:23 GMT):[color=green]
      > > session_cache_l imiter('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.[/color]
      >
      > These headers only apply to the document in which you use them.[/color]
      I added the above script to the page which displays the pictures with no
      success.
      [color=blue]
      >Do you generate pictures with a PHP script?[/color]
      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">
      [color=blue]
      > Supposedly, from the web server response headers, given that it's[/color]
      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?
      [color=blue]
      > You can find out in "Internet Options-> Temporary Internet Files->[/color]
      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


      Comment

      • Alvaro G. Vicario

        #4
        Re: Image not refreshing

        *** Ken escribió/wrote (Thu, 16 Sep 2004 19:38:47 GMT):[color=blue][color=green]
        >>Do you generate pictures with a PHP script?[/color]
        > 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">[/color]

        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.
        [color=blue]
        > My computer is set for automatic. If I set it for "every visit to page" the
        > picture display properly.[/color]

        Then the web server is configured correctly.
        [color=blue]
        > 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".[/color]

        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.jp g?foo=<?=$rando m_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
        --

        Comment

        • Jon Beckett

          #5
          Re: Image not refreshing

          >My computer is set for automatic. If I set it for "every visit to page" the[color=blue]
          >picture display properly.[/color]

          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 (jonbeckett@plu ggedout.com)
          working on : http://www.pluggedout.com/penpals

          Comment

          • Gordon Burditt

            #6
            Re: Image not refreshing

            >How does IE6 control the display of images?[color=blue]
            >
            >I change the content of a image file image1.jpg without changing the file
            >name. Then jump to a new page to display it.[/color]

            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.
            [color=blue]
            >IE6 does not displays the original picture, not the new image.[/color]

            If it doesn't display the original picture, and it doesn't
            display the new image, what DOES it do?
            [color=blue]
            >Where is IE6 getting the info (image1.jpg) for the picture?[/color]

            Probably out of its cache.

            [color=blue]
            >How do I force IE6 to display the new picture?[/color]

            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("image 1.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.j pg", "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

            Comment

            • Ken

              #7
              Re: Image not refreshing

              "Alvaro G. Vicario" <kAlvaroNOSPAMT HANKS@terra.es> wrote in message
              news:1n2f93lvdr eny$.yqiy0gnsfy fx.dlg@40tude.n et...[color=blue]
              > *** Ken escribió/wrote (Thu, 16 Sep 2004 19:38:47 GMT):[color=green][color=darkred]
              > >>Do you generate pictures with a PHP script?[/color]
              > > PHP handles the picture input and conversion (picture9 to new_file_name)[/color][/color]
              to[color=blue][color=green]
              > > a different name.
              > > <input type=file size=65 name="picture9" Id="pt9">
              > > <img src="<?php echo $_SESSION['new_file_name'];?> " border="0"[/color][/color]
              width="100">[color=blue]
              >
              > 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[/color]
              linked[color=blue]
              > files.
              >[color=green]
              > > My computer is set for automatic. If I set it for "every visit to page"[/color][/color]
              the[color=blue][color=green]
              > > picture display properly.[/color]
              >
              > Then the web server is configured correctly.
              >[color=green]
              > > Unfortunately, I cannot change the selected setting on the web page[/color][/color]
              viewers.[color=blue][color=green]
              > > So I am looking for a PHP command to force the page to "Check for newer
              > > version of stored page for each visit".[/color]
              >
              > 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.jp g?foo=<?=$rando m_string?>">
              >
              >
              > --
              > -+ Álvaro G. Vicario - Burgos, Spain
              > +- http://www.demogracia.com (la web de humor barnizada para la[/color]
              intemperie)[color=blue]
              > ++ 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[/color]

              Thanks Alvaro,

              This worked.

              Great idea.

              Ken


              Comment

              Working...