<?php
// configura o array de pontos para o polígono
$values = array(
40, 50, // Ponto 1 (x, y)
20, 240, // Ponto 2 (x, y)
60, 60, // Ponto 3 (x, y)
240, 20, // Ponto 4 (x, y)
50, 40, // Ponto 5 (x, y)
10, 10 // Ponto 6 (x, y)
);
// cria imagem
$image = imagecreatetruecolor(250, 250);
// aloca cores
$bg = imagecolorallocate($image, 0, 0, 0);
$blue = imagecolorallocate($image, 0, 0, 255);
// preenche o fundo
imagefilledrectangle($image, 0, 0, 249, 249, $bg);
// desenha um polígono
imagefilledpolygon($image, $values, $blue);
// descarrega a imagem
header('Content-type: image/png');
imagepng($image);
?>
O exemplo acima produzirá
algo semelhante a: