Re: Images
| From: | PHP List | Date: | Thu, 20 Dec 2001 19:47:07 +0000 |
| Subject: | Re: Images | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-78350@lists.php.net to get a copy of this message | ||
Thanks, but my html is valid, and what you are doing is not what I want to
do.
I want to display a random image included in the page, just like a banner
program would work.
I do not allow php execution on the page so the only way to get the image is
to call the script with the img src tag, just like a banner program would.
> First of all your HTML is not valid. Secondly I believe you're making it
> more complex than it needs to be. And since this is ending up in HTML
> anyway you don't need to concern yourself with the headers. Start off
with
> something simple like what I have below, and go from there.
>
> <html>
> <a href="show_image.php?image=1">Display myPicture.gif</a>
>
> <? // show_image.php script
> if ($image) {echo "<img
> src=\"http://www.myurl.com/mypicture.gif\">;}
> ?>
> </html>
>
> Hope this helps,
> Kevin
>
> > Hi,
> > I am trying to do something like this:
> > <img src="image.php?image=1">
> >
> > The code is like this:
> >
> > <script language="php">
> > $szPicture = "myimage.gif";
> >
> > $url = "http://www.mysite.com/" . $szPicture;
> > header("Content-type: image/gif");
> > header("Content-Length: " . strlen($url));
> > echo $url;
> > </script>
> >
> > But nothing happens, I just get the broken image.
> > My logs show nothing about a script failure or about a file not being
> found.
> > I tried without the header("Content-Length: " . strlen($url)); but no
> diff.
> >
> > Thanks for any help.
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >