Draw ellipse and arc on png image in PHP
Description
The following code shows how to draw ellipse and arc on png image.
Example
<?php// w w w .ja v a2 s . c o m
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);
?>
The code above generates the following result.