imageellipse 


gd apg

DRAW an ellipse centered at the specified image file coordinates.





This function returns TRUE on success or FALSE on failure.



<?php

bool imageellipse 
( GdImage $image, 
                                        
int $center_x, int $center_y, 
                                        
int $width, int $height, int $color )

where,

$image = The image identifier

$center_x 
= The x-coordinate - the center point 

$center_y 
= The y-coordinate - the center point 

$width 
= The width of the ellipse

$height 
= The height of the ellipse 

$color 
= The color as returned by imagecolorallocate

?>
 

  $image   


The image identifier.



  $center_x   


The x-coordinate - the center point.



  $center_y   


The y-coordinate - the center point.



  $width   


The width of the ellipse



  $height   


The height of the ellipse.



  $color   


The color identifier created by imagecolorallocate.



  1 EXERCISE   

<?php

echo 'PHP VERSION: ' . PHP_VERSION . '<br><br>';

$base_img = "png/baseXx.png";

$dest_img = 'png/PNG 063 01 imageellipse.png';

$id_ellps1 = imagecreatefrompng($base_img);
$red = imagecolorallocate($id_ellps1, 238, 0, 0);
$black = imagecolorallocate($id_ellps1, 0, 0, 0);
$blue = imagecolorallocate($id_ellps1, 0, 0, 238);

/* - -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
   circle
   
   horizontal_axle = vertical_axle
   - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */
   
$xc0ellps1 = 200;
$yc0ellps1 = 150;
$horizontal_axleellps1 = 200;
$vertical_axleellps1 = 200; 
imageellipse($id_ellps1, $xc0ellps1, 
                                      
$yc0ellps1, 
                                      
$horizontal_axleellps1, 
                                      
$vertical_axleellps1, 
                                      
$red);

/* - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
   ellipse 1
   
   horizontal_axle < vertical_axle
   - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - */ 

$xc0ellps1 = 200;
$yc0ellps1 = 150;
$horizontal_axleellps1 = 50;
$vertical_axleellps1 = 200; 
imageellipse($id_ellps1, $xc0ellps1, 
                                      
$yc0ellps1, 
                                      
$horizontal_axleellps1, 
                                      
$vertical_axleellps1, 
                                      
$black);

/* - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
   ellipse 2
   
   horizontal_axle > vertical_axle
   - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - */ 

$xc0ellps1 = 200;
$yc0ellps1 = 150;
$horizontal_axleellps1 = 200;
$vertical_axleellps1 = 50; 
imageellipse($id_ellps1, $xc0ellps1, 
                                      
$yc0ellps1, 
                                      
$horizontal_axleellps1, 
                                      
$vertical_axleellps1, 
                                      
$blue);

imagepng($id_ellps1, $dest_img);
?>

<?php echo basename($dest_img); ?>
<br><br><img src="<?php echo $dest_img; ?>" 
alt="<?php echo $dest_img; ?>"><br>


 RESULT   

PNG 063 01 imageellipse.png

PNG 063 01 imageellipse.png apr

  2 EXERCISE   

<?php

echo 'PHP VERSION: ' . PHP_VERSION . '<br><br>';

$base_img = "png/baseXx.png";

$dest_img = 'png/PNG 063 02 imageellipse.png'; 

$id_ellps2 = imagecreatefrompng($base_img); 

// Draw a white ellipse
imageellipse($id_ellps2, 180, 150, 280, 200, 26000000);

imagepng($id_ellps2, $dest_img);
?>

<?php echo basename($dest_img); ?>
<br><br><img src="<?php echo $dest_img; ?>" 
alt="<?php echo $dest_img; ?>"><br>


 RESULT   

PNG 063 02 imageellipse.png

PNG 063 02 imageellipse.png apr

  3 EXERCISE   

<?php

echo 'PHP VERSION: ' . PHP_VERSION . '<br><br>';

$id_img3 = imagecreatetruecolor(380, 300);

$base_img = "png/PNG 063 03.png";

$dest_img = 'png/PNG 063 03 imageellipse.png'; 

imagepng($id_img3, $base_img);

echo 
basename($base_img) . '<br><br><img src="' . $base_img . 
      
'" alt="' . $base_img . '" title="' . $base_img . '"><br><br>'; 

$id_ellps3 = imagecreatefrompng($base_img); 

// Draw a white ellipse
imageellipse($id_ellps3, 180, 150, 280, 200, 26000000);

imagepng($id_ellps3, $dest_img);
?>

<?php echo basename($dest_img); ?>
<br><br><img src="<?php echo $dest_img; ?>" 
alt="<?php echo $dest_img; ?>"><br>


 RESULT   

PNG 063 03.png

PNG 063 03.png apr


PNG 063 03 imageellipse.png

PNG 063 03 imageellipse.png apr