RE: [PHP] How to force an image to reload
| From: | ed at home dot homes2see dot com | Date: | Tue, 10 Dec 2002 19:11:13 +0000 |
| Subject: | RE: [PHP] How to force an image to reload | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-127700@lists.php.net to get a copy of this message | ||
Even though I did forget the ending > on the tag. Cool.
Ed
On Tue, 10 Dec 2002, Adam White wrote:
> Many thanks Ed, works a treat!
>
> Regards
> Adam White
>
> ----Original Message-----
> From: ed@home.homes2see.com [mailto:ed@home.homes2see.com]
> Sent: 10 December 2002 18:31
> To: Adam White
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] How to force an image to reload
>
>
> As one who has had to do the same thing and had gotten some help from
> this list I'll put in my two cents.
>
> <? $rand = rand(1000,9999); ?>
>
> <img src="image.jpg?<? echo $rand; ?>
>
> This echoes a ? with a random number behind the filename forcing a request
> to the server for the image because you probably wont have that exact same
> image with the random number in your cache.
>
> Ed
>
>
>
> On Tue, 10 Dec 2002, Adam White wrote:
>
> > Guys, not sure if this is a PHP problem or a more general HTML problem,
> > but...
> >
> > I've written a small test script (see below), basically, which allows the
> > user to rotate an image by 90degrees.
> > When I press the button, the page reloads having rotated the image, but
> the
> > old image is still displayed. (I know it's done it if I load up another
> > browser window)
> > Pressing refresh does cause the image to reload.
> >
> > Any ideas???
> >
> > <?php
> > header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in
> > the past
> > header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "
> > GMT"); // always
> > modified
> > header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
> > header("Cache-Control: post-check=0, pre-check=0", false);
> > header("Pragma: no-cache"); // HTTP/1.0
> > ?>
> > <head>
> > <TITLE>Yama!</TITLE>
> > </head>
> > <body>
> > <p />
> > <?php
> > if($submit == "Rotate 90")
> > {
> > $output=
mogrify -rotate 90 pictures/028_25.jpg;
> > echo "$output<p />";
> > }
> > $submit=" ";
> > echo "new value of submit=$submit";
> > ?>
> >
> > <form name="form1" action="<?php echo($PHP_SELF) ?>"
> > method="post">
> > <input type="submit" name="submit" value="Rotate 90">
> > </form>
> > <p />
> > <img src = pictures/028_25.jpg>
> > </body>
> > </html>
> >
> > Regards & thanks in advance
> > Adam White
> >
> >
> >
> > --
> > 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
>