Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

imagearc

Description

The imagearc of Image for PHP draws an arc.

Syntax

imagearc(
    GdImage $image,
    int $center_x,
    int $center_y,
    int $width,
    int $height,
    int $start_angle,
    int $end_angle,
    int $color
): bool

Parameters

image

A GdImage object, returned by one of the image creation functions, such as imagecreatetruecolor().

center_x

x-coordinate of the center.

center_y

y-coordinate of the center.

width

The arc width.

height

The arc height.

start_angle

The arc start angle, in degrees.

end_angle

The arc end angle, in degrees. 0° is located at the three-o'clock position, and the arc is drawn clockwise.

color

A color identifier created with imagecolorallocate().

Return

Returns true on success or false on failure.

Examples

1 · return

<?

$width = 100;
$height = 100;
$image = imagecreate($width, $height);

$red = 255;
$green = 255;
$blue = 255;
$color = imagecolorallocate($image, $red, $green, $blue);

$center_x = 50;
$center_y = 50;
$start_angle = 90;
$end_angle = 360;

$return = imagearc($image, $center_x, $center_y, $width, $height, $start_angle, $end_angle, $color);
    
var_export($return);

?>
true

2 · base64

<?

$width = 100;
$height = 100;
$image = imagecreatetruecolor($width, $height);

$red = 255;
$green = 255;
$blue = 255;
$color = imagecolorallocate($image, $red, $green, $blue);

$center_x = 50;
$center_y = 50;
$start_angle = 90;
$end_angle = 360;
imagearc($image, $center_x, $center_y, $width, $height, $start_angle, $end_angle, $color);

ob_start();

    imagepng($image);

$output = ob_get_clean();

echo '<!doctype html>
<html>
<body>
    <img src="data:image/png;base64,' . base64_encode($output) . '">
</body>
</html>';

?>
<!doctype html>
<html>
<body>
    <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABuElEQVR4nO3dW5LCIBQA0Tj73zPzQZVFmYc0hmf6LCCB9hL9Mts2pBBC7yUceHW8d3GR16vPslvfNQ1UvOdbLlKg0Z3e27t9b/Wu3EEIoc0DqMGNan0avT7wqve9/4ojnIsR1vBFsxOXb8AlbduwyxpwYWOt5sgQKxzuczvXeamzZEp1WPNEA7XXdPFTl4oabWH2TCm6l7+qVx9frR0tcPr2qmxqvUypzN1lHcO1S0W37dFYba8yg193+pxS0fV+2U8HnXraWEUlu35mqehs78fH8MmlIlDAWLkFLBXtO/htCHzGcqxSX2oYK/VRw2NYyrHaS5s4WUUcqzPvMk4WYCzOM3gt9nGyAGMBxoJ8YOUIIThZgLEAYwHGAowFGAswFmAs4M9fpIy9MnkMAWMBxgKMBRgLMBZgLMBYnL9LczhZgLEAYxXxsfWVkwUYq5Qn8ZqT9QOH64KTBRzEcrgAY53xGP7M4Tp0Oln2AozF2IuxV8pvw1s5XIy9otxjaC/AWMyS//lXkb0YYzHOF2MvzF6MI4bZi3HEmOV7rfnenUpWe6PT3FY6m9O/ha6lKd9v2Mu4b84cMOU/y5tkM6Z53CQAAAAASUVORK5CYII=">
</body>
</html>
HomeMenu