Click to See Complete Forum and Search --> : php gd problem


ledaker
December 18th, 2008, 05:09 PM
hi all, i am using GD library of php

$x = 200; //largeur de mon image en PIXELS uniquement !
$y = 200; //hauteur de mon image en PIXELS uniquement !

$image = imagecreatetruecolor($x,$y);

$couleur = imagecolorallocate($image,255,0,0);

$coords = array('5','5', // point 1
'190', '190', // point 2
'160','40'); // point 3

imagefilledpolygon($image,$coords,3,$couleur);
imagepng($image,"1.png");
imagedestroy($image);

the polygon did not filled with the red color why

PeejAvery
December 19th, 2008, 07:40 AM
You haven't declared that it's output should be an image.

header('Content-type: image/png');