Re: png image doesn't show
| From: | Richard Lynch | Date: | Sat, 06 Jul 2002 04:59:32 +0000 |
| Subject: | Re: png image doesn't show | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-105823@lists.php.net to get a copy of this message | ||
>Hello all,
>
>I have been trying to modify the working of one of my pages which prints a
>png graph. What I had was an included file named "graphit.php" which
>creates a png file. I used the function
>imagepng($image,'temp.png') to create an image and then used <img
>src=temp.png> to have the image printed on the page. This worked well
>enough when only one user (me) was using the page, but I want more. In
>reading the imagepng() info in the manual, it states that I can output the
>raw image stream to the browser by leaving off the file name option. I've
>done this, but get nada! How should this be done?
>One of the notes (and it's in German) implies that I can call "graphit.php"
>using something like
>
><img src=graphit.php> to get the image output. Unfortunately, I get
>nothing except the red X indicating a missing image.
>
>Any and all help is greatly appreciated.
Tips:
1. Change graphit.php to have the header("Content-type: image/png") line at
the *END* of the script, right before you do imagepng($image)
2. Surf directly to graphit.php, and not the page with <IMG SRC=graphit.php>
in it.
At this point, you'll probably find some PHP error messages from graphit.php
-- They don't look anything like a PNG image, so the browser can't display
them :-)
--
Like Music? http://l-i-e.com/artists.htm