imagepng(); Error
I have the following code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Test Site</title>
</head>
<body>
<?php
$MyImage = imagecreate(200,100);
$MyGrey = imagecolorallocate($MyImage,204,204,204);
$MyBlack = imagecolorallocate($MyImage,0,0,0);
imageline($MyImage, 15, 35, 120, 60, $MyBlack);
header("content-type: image/png");
imagepng($MyImage);
imagedestroy($MyImage);
?>
<p> </p>
<p>Test Page
</p>
</body>
</html>
---------------
When I run this, I get the following:
â°PNG IHDRÃdùHÃHPLTEÃÃÃÃ33dMIDATxÅc`£` Ãx§â Nf*k²Ã)Ãø§ââ¢5}Ã)Ã
ÂSâ ÂÃÅ¡pJUà â a§²¦Å2ÃŽw<Å¡pJÂâQ0 â ; u%ÃæÃIEND®B`â
Test Page
--------------
Why is it not displaying the image instead of the code?
PHP v. 5.1.4
in phpinfo();
GD Support enabled
GD Version bundled (2.0.28 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.1.9
T1Lib Support enabled
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled
Thank you.
|