imageellipse()
The imageellipse() function accepts six parameters, which are:
The function returns true on success, or false on failure.
<?php
// Create a blank image
$image = imagecreatetruecolor(700, 350);
// Select the background color
$bg = imagecolorallocate($image, 0, 0, 0);
// Fill the background with the selected color
imagefill($image, 0, 0, $bg);
// Choose a color for the ellipse
$col_ellipse = imagecolorallocate($image, 255, 255, 255);
// Draw the ellipse
imageellipse($image, 325, 175, 500, 175, $col_ellipse);
// Output the image
header("Content-type: image/png");
imagepng($image);
?>
<?php
// Create a blank image
$image = imagecreatetruecolor(700, 600);
// Set the background color
$bg = imagecolorallocate($image, 122, 122, 122);
// Fill the background with the selected color
imagefill($image, 0, 0, $bg);
// Set the color of the ellipse
$col_ellipse = imagecolorallocate($image, 0, 255, 255);
// Draw the ellipse
imageellipse($image, 250, 300, 300, 550, $col_ellipse);
// Output the image
header("Content-type: image/gif");
imagepng($image);
?>
The above examples show how to use the imageellipse() function in PHP to draw ellipses. This function is useful for various image drawing tasks and can be applied to web development or image processing projects.