Complex Shapes : imagefilledpolygon « Graphics Image « PHP






Complex Shapes

 
<?
    $points = array(
            20, // x1, top-left
            20, // y1

            230, // x2, top-right
            20, // y2

            230, // x3, bottom-right
            230, // y3

            20, // x4, bottom-left
            230 // y4
    );

    $image = imagecreatetruecolor(250, 250);
    $green = imagecolorallocate($image, 0, 255, 0);
    imagefilledpolygon($image, $points, 4, $green );

    header('Content-type: image/png');
    imagepng($image);
    imagedestroy($image);
?>
  
  








Related examples in the same category

1.Drawing a Polygon with imagefilledpolygon()