codice:
<?php
header("Content-type: image/png");
$im = @imagecreate(100, 250) or die("Cannot Initialize new GD image stream");
$black = imagecolorallocate($im, 0, 0, 0);
$white = imagecolorallocate($im, 255, 255, 255);
$red = imagecolorallocate($im, 255, 0, 0);
$green = imagecolorallocate($im, 0, 255, 0);
$blue = imagecolorallocate($im, 0, 0, 255);
imagefilledrectangle($im, 0, 0, 100, 50, $white);
imagefilledrectangle($im, 0, 50, 100, 100, $red);
imagefilledrectangle($im, 0, 100, 100, 150, $green);
imagefilledrectangle($im, 0, 150, 100, 200, $blue);
imagefilledrectangle($im, 0, 200, 100, 250, $black);
imagepng($im);
imagedestroy($im);
?>
Crea un rettangolo con strisce nell'ordine bianca, rossa, verde, blu e nera. Guarda se i colori sono rispettati.