Re: Images
| From: | Joel Boonstra | Date: | Thu, 20 Dec 2001 20:14:15 +0000 |
| Subject: | Re: Images | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-78352@lists.php.net to get a copy of this message | ||
> > > <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>
You're properly printing out the Content-type header, but not the actual
image data. You need to get the get the binary data (probably using a
binary-safe read) from the image file you want to display (in $url), and
then print that data out after the content-type header.
Right now, a browser would get sent a content-type header for a gif, and
then the following string:
http://www.mysite.com/myimage.gif
and that's not valid contents for a .gif file.
Joel
--
[ joel boonstra | jboonstra@gospelcom.net ]