PHP Code:
// Create new image
$image = imagecreatetruecolor(200, 200);
// Define the colors in RGB format, values of each being 0-255
$red = imagecolorallocate($image, 255, 0, 0);
$green = imagecolorallocate($image, 0, 255, 0);
$blue = imagecolorallocate($image, 0, 0, 255);
// Create a rectagle with a top left corner at point 10,10 and bottom right at 40,40
imagefilledrectangle($image, 10, 10, 40, 40, $red);
imagefilledellipse($image, 100, 100, 50, 50, $green);
imagefilledrectangle($image, 30, 30, 80, 80, $blue);
// Save the images
imagejpeg($image, "test.jpg", 100);
// Destroy image, removing it from memory
imagedestroy($image);
Simple image script, it will create two rectangles and a circle. The process of creating an image is
1) Create a blank image or create a copy of an existing one
2) Define colors
3) Do whatever modification to the image be it adding shapes, text, etc
4) Save the image
5) Destroy the image, that is the copy of the image that is in memory on the server.
Here's a link to all of the GD functions
http://us.php.net/manual/en/ref.image.php
I hope this helps, feel free to ask if you have any questions, I will help if I can