English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

PHP Basic Tutorial

PHP Advanced Tutorial

PHP & MySQL

PHP Reference Manual

PHP imagearc() function drawing elliptical arc usage and example

PHP Image Processing

imagearc — used to draw an elliptical arc.

syntax

bool imagearc ( resource $image , int $cx , int $cy , int $w , int $h , int $s , int $e , int $color )

imagearc() draws an elliptical arc in the image represented by image, with cx, cy (the top left corner of the image is 0, 0) as the center.

w and h specify the width and height of the ellipse, the starting and ending points are specified by the s and e parameters in degrees. 0° is located at the 3 o'clock position, and is drawn in a clockwise direction.

example

<?php
$img = imagecreatetruecolor(200, 200);// create a 200*200 image
$white = imagecolorallocate($img,   255,   255, 255); // color
// draw an elliptical arc
imagearc($img, 140,  75,  50,  50, 0, 360, $white);
// browser output image
header("Content-type: image/png");
imagepng($img);
imagedestroy($img);
?>

PHP Image Processing