I use this code:
<?php
$height = 200;
$width = 200;
$im = imagecreate($width, $height);
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
imagefill($im, 0, 0, $black);
imageline($im, 0 ,0 ,$width, $height, $white);
header ("Content-type: image/png");
imagepng($im);
imagedestroy($im);
?>
and this is what i got:
‰PNG IHDRÈÈ—–<ÝPLTEÿÿÿUÂÓ~µIDATxœuϹ1ÀÐé|K£J $àï܇
problem with generating an image
Moderator: General Moderators
Do you need the header() function? It looks to me as though the binary code for the image is being printed out... Take out the header() function and see what happens!
Check this out as well:-
http://uk.php.net/manual/en/function.imagepng.php
Check this out as well:-
http://uk.php.net/manual/en/function.imagepng.php