This example shows how to display graphics in php gd.
This example shows how to display graphics in php gd.<?php
$img = imagecreate(250,80);
$black = imagecolorallocate($img, 0, 0, 0);
$white = imagecolorallocate($img, 255, 255, 255);
$red = imagecolorallocate($img, 255, 0, 0);
$green = imagecolorallocate($img, 0, 255, 0);
$blue = imagecolorallocate($img, 0, 0, 255);
$corners = array(
0 => 190,
1 => 60,
2 => 210,
3 => 20,
4 => 230,
5 => 60,
);
imagerectangle($img, 10, 10, 240, 70, $white);
imagefilledrectangle($img, 20, 20, 60, 60, $red);
imagefilledellipse($img, 90, 40, 40, 40, $blue);
imagefilledellipse($img, 150, 40, 70, 40, $green);
imagefilledpolygon($img, $corners, 3, $white);
header ("Content-type: image/jpeg");
imagejpeg($img);
imagedestroy($img);
?>
After running the program you will get the following output