Using the imagepolygon() function:
You can create a shape using coordinates with the imagepolygon () function. You need to include an imagecreate (), the coordinates for your shape in an array, the number of coordinates, and the line color you wish to use as variables in the function.
<?php
// create a blank image
$image = imagecreate(200, 110) ;
// background color
$bg = imagecolorallocate($image, 225, 0, 0) ;
// line color
$color = imagecolorallocate($image, 255, 255, 255) ;
// draw the shape
imagepolygon($image,
array (
0, 0,
100, 90,
180, 100,
100,10 ),
4,
$color);
// output the picture
header("Content-type: image/png") ;
imagepng($image) ;
?>
You can also cross coordinates to make more abstract shapes. In the example we are saving the file as a PNG type file but it could also be changed to make a JPG. Like other GD Library functions, drawing a polygon can be used with other functions to make more complex images. 



