i think you missunderstood what I said.

in the image tag that you create to display the image, you could do this

<img src='/path/to/image/myfile.jpg?<?=filetime($filename)?>'>

that would make the URL different when each page time the image was
replaced.

I would use filetime() because it would not cause extra downloads if the
file wasn't different.

if someone looked at the file 2 seconds apart and it didn't change, it was
waisted time and bandwidth down loading the file again.

Jim


----- Original Message -----
From: "Philip Hallstrom" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, January 20, 2003 4:11 PM
Subject: [PHP] Re: Cannot show reuploaded image file on page unless manual
refresh


> I wonder if appending time() would be better... granular to a second and
> you save the filesystem lookup effort??
>
> On Mon, 20 Jan 2003, Jim Lucas wrote:
>
> > I would add the modification time of the file in question with
> >
> > filetime($filename);
> >
> > that way you will be sure to get a unique argurment.
> >
> > Jim
> >
> > ----- Original Message -----
> > From: <[EMAIL PROTECTED]>
> > To: "Chris Shiflett" <[EMAIL PROTECTED]>
> > Cc: "Phil Powell" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
> > <[EMAIL PROTECTED]>
> > Sent: Monday, January 20, 2003 10:48 AM
> > Subject: Re:  Cannot show reuploaded image file on page unless manual
> > refresh
> >
> >
> > >
> > >  Aha! Something I can chime in on. I happened across the same scenario
a
> > > few months back. The list helped me then so I'll give back.
> > >
> > >  Call the image using a random identifier.
> > >
> > > $rand = rand(1000, 9999);
> > >
> > > echo "<img src="http://someurl.com/image.jpg?$rand";;
> > >
> > > Since the browser will more than likely not have the image file
identified
> > > by the random number it must request it again from the server. Works
> > > great where I need it!
> > >
> > > Ed
> > >
> > > On Mon, 20 Jan 2003, Chris Shiflett wrote:
> > >
> > > > --- Phil Powell <[EMAIL PROTECTED]> wrote:
> > > > > I am using the following header() functions to force
> > > > > view.php to not cache:
> > > > >
> > > > > header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
> > > > > header("Last-Modified: " . gmdate("D, d M Y H: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");
> > > >
> > > > :-)
> > > >
> > > > I think you killed it.
> > > >
> > > > > However, when a user reuploads a file in manage.php, it
> > > > > does a form post onto manage.php and reuploads the file
> > > > > (which I verified works).  However, when redirected via
> > > > > header() to view.php, they still see their OLD image
> > > > > file, NOT the new one!  Unless I manually refresh the
> > > > > page, they never see it, until they manually refresh the
> > > > > page, then the new image file appears!
> > > >
> > > > Right.
> > > >
> > > > I think you are forgetting that the image is not really
> > > > part of the PHP resource. Meaning, this is the series of
> > > > events for a PHP script that refernces a single image
> > > > called bar.jpg using the <img> tag:
> > > >
> > > > 1. HTTP request sent for foo.php (Web client -> Web server)
> > > > 2. HTTP response sent that includes the output of foo.php
> > > >    (Web server -> Web client)
> > > > 3. Web client (browser) notices <img> tag referenced in
> > > >    the HTML.
> > > > 4. HTTP request sent for bar.jpg (Web client -> Web server)
> > > > 5. HTTP response sent that includes bar.jpg
> > > >
> > > > So, the headers that you are setting only matter for the
> > > > resource returned in step 2. Meaning, the HTML output of
> > > > foo.php is not cached. The image, since it is returned by
> > > > the Web server and not your PHP script, is cached.
> > > >
> > > > Chris
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



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

Reply via email to