<!DOCTYPE html>
<html lang="de">
<head>
   <meta charset="utf-8">
   <title>Rechteck, Polygon</title>
</head>
<body>
<?php
   $im = imagecreate(400,100);
   $grau = imagecolorallocate($im, 192, 192, 192);
   imagefill($im, 0, 0, $grau);
   $s = imagecolorallocate($im, 0, 0, 0);

   imagerectangle($im, 25, 25, 75, 75, $s);
   imagefilledrectangle($im, 95, 25, 145, 75, $s);

   $poly1 = array(165, 25, 190, 75, 215, 25);
   imagepolygon($im, $poly1, 3, $s);

   $poly2 = array(240, 25, 265, 75, 290, 25);
   imagefilledpolygon($im, $poly2, 3, $s);

   $poly3 = array(315, 25, 340, 75, 365, 25);
   imageopenpolygon($im, $poly3, 3, $s);

   imagejpeg($im, "im_test.jpg");
   imagedestroy($im);
?>
<img src="im_test.jpg" alt="[Bild]">
</body>
</html>