Computer >> Computer tutorials >  >> Programming >> PHP

imagefilledellipse() function in PHP


The imagefilledellipse() function is used to draw a filled ellipse.

Syntax

imagefilledellipse( $img, $cx, $cy, $width, $height, $color )

Parameters

  • img This creates a blank image with imagecreatetruecolor()

  • cx x-coordinate of the center.

  • cy y-coordinate of the center.

  • width The ellipse width.

  • height The ellipse height.

  • color The fill color.

Return

The imagefilledellipse() function returns TRUE on success or FALSE on failure.

Example

The following is an example:

<?php
   $img = imagecreatetruecolor(450, 290);
   $bgColor = imagecolorallocate($img, 140, 180, 140);
   imagefill($img, 0, 0, $bgColor);
   $ellipse = imagecolorallocate($img, 120, 50, 70);
   imagefilledellipse($img, 225, 150, 400, 250, $ellipse);
   header("Content-type: image/png");
   imagepng($img);
?>

Output

The following is the output:

imagefilledellipse() function in PHP