Kreslenie štvorcov cez GD.

<? 
$im = ImageCreate(301, 301); 
$bgc = ImageColorAllocate($im,255,255,255); 
$tc = ImageColorAllocate($im,0,0,0); 
$blue = ImageColorAllocate($im,60,155,236); 
$brown = ImageColorAllocate($im,198,108,0); 
 
ImageLine($im, 0, 100, 150, 0, $tc); 
ImageLine($im, 150, 0, 300, 100, $tc); 
 
ImageRectangle($im, 1, 100, 300, 300, $tc); 
//ImageRectangle(image, x1, y1, x2, y2, color); 
 
ImageRectangle($im, 50, 150, 150, 250, $tc); 
ImageFilledRectangle($im, 51, 151, 149, 249, $blue); 
//ImageFilledRectangle(image, x1, y1, x2, y2, color); 
 
ImageRectangle($im, 200, 150, 270, 300, $tc); 
ImageFilledRectangle($im, 201, 151, 269, 299, $brown); 
 
Header("Content-type: image/gif"); 
ImageGif($im); 
?>