Using the imageellipse() and imagearc() Functions
<?php
define("WIDTH", 200);
define("HEIGHT", 100);
$img = imagecreate(WIDTH, HEIGHT);
$bg = imagecolorallocate($img, 0xFF, 0xFF, 0xFF);
$black = imagecolorallocate($img, 0, 0, 0);
$red = imagecolorallocate($img, 0xFF, 0, 0);
$center_x = (int)WIDTH/2;
$center_y = (int)HEIGHT/2;
imageellipse($img, $center_x, $center_y, WIDTH, HEIGHT, $black);
imagearc($img, $center_x, $center_y, WIDTH-5, HEIGHT-5, 0, 360, $red);
header("Content-Type: image/png");
imagepng($img);
?>
Related examples in the same category