קוד:
<?php
// example4.php
// set the HTTP header type to PNG
header("Content-type: image/png");
// set the width and height of the new image in pixels
$width = 350;
$height = 360;
// create a pointer to a new true colour image
$im = ImageCreateTrueColor($width, $height);
// switch on image antialising if it is available
ImageAntiAlias($im, true);
// sets background to white
$white = ImageColorAllocate($im, 255, 255, 255);
ImageFillToBorder($im, 0, 0, $white, $white);
// define black and blue colours
$black = ImageColorAllocate($im, 0, 0, 0);
$blue = ImageColorAllocate($im, 0, 0, 255);
// draw an empty circle
ImageEllipse($im, 180, 100, 100, 100, $black);
// draw a filled ellipse
ImageFilledEllipse($im, 180, 220, 150, 50, $blue);
// send the new PNG image to the browser
ImagePNG($im);
// destroy the reference pointer to the image in memory to free up resources
ImageDestroy($im);
?>
View Example 4
To draw a circle or an ellipse, we use the same ImageEllipse function. The parameters provided to this function are: image resource, center x, center y, width, height, colour. As you can see from the above example, all you need to do to draw a circle rather than an ellipse is to set the width and height to the same value.
מקור:
http://www.design-ireland.net/index....imagery-15.php