ImagePNG() ouputs to the browser unless you specify the filename parameter
So those funny symbols you are seeing is the PNG file but displayed as text.
To fix this you need to add a

Header("Content-type: image/png");

somewhere in your PHP (preferably before ImagePNG), and it will tell your
browser that the data being sent is a PNG file, not normal text/html.

You may see the funny characters, or a red cross if you decide to use echo,
print, print_r or similar functions, since these will output to the browser
along with the PNG file, thus corrupting the image.

Oh My I just noticed you have HTML in there as well :/.... If you are doing
something like:
echo '<html><body>';
ImagePNG(); //I want the image to appear here
echo '</body></html>';

Then you will need to do:
echo '<html><body>';
echo '<img src="somephpfile.php">
echo '</body></html>';

and in somephpfile.php you will have the code to generate the image
including the ImagePNG();

Andrew

----- Original Message -----
From: "Ignacio Correa" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, September 23, 2003 5:43 PM
Subject: [PHP] GD problem


Hi, I´m new in PHP+GD.
I have install all library (PHP4-gd2, libgd2, etc, etc, etc.) and when I use
gd functions no errors or warning are displayed, but when I use imagepng()
or imagejpeg() no images are displayed in my browser, and in this place
extrage symbols are displayed.
You can see my bad result here:
http://www.drivingconsultancy.com/ide/testi.php

If somebody can helpme, I´ll be very thanks

(sorry, my eglish isn´t good, I´m from Argentine)

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

Reply via email to