Isaac's code for Drawing Circles and Ovals

circle and oval

SLAVE CODE FOLLOWS

<?php        // create a PNG image file

// create a blank image that is 410 pixels wide and 300 pixels tall
$image = imagecreate(410, 300);

// create a color and fill (paint) the work area
// set the color RGB (238, 238, 238), which is GRAY
$gray = imagecolorallocate($image, 238, 238, 238);

//  fill the entire image (410 px x 300 px)
imagefilledrectangle($image, 0, 0, 410, 300, $gray);

// === create an object (a circle)

// set the current foreground color to RGB (0, 0, 255), which is BLUE
$color = imagecolorallocate ($image, 0, 0, 255);

// DRAW a circle (image, x, y, arc-width, arc-height, start-angle, end-angle, color)
imagearc($image, 100, 150, 100, 200,  0, 360, $color);

// set the current foreground color to RGB (0, 0, 255), which is BLUE
$color = imagecolorallocate ($image, 255, 0, 0);

// DRAW a circle (image, x, y, arc-width, arc-height, start-angle, end-angle, color)
imagearc($image, 300, 150, 100, 200,  0, 360, $color);

// === create an object (an oval)

// set the current foreground color to RGB (0, 255, 0), which is RED
$color = imagecolorallocate ($image, 50, 0, 100);

// DRAW an oval (image, x, y, arc-width, arc-height, start-angle, end-angle, color)
imagearc($image, 200, 150, 400, 50,  0, 360, $color);

//=== display the image

// tell the server that a PNG image  follows
header("Content-type: image/png");

// display the image
imagepng($image);

// destroy the image (i.e., release memory)
imagedestroy ($image);

?>