imageopenpolygon 


gd apg

DRAW an open polygon with specified image file points.





The number of elements in $points must be equal to twice the number in $num_points.

Contrary to the function imagepolygon, no line is drawn between the last and the first point.

This function is only available for PHP 7.2.0 or higher.

This function returns TRUE on success or FALSE on failure.



<?php

bool imageopenpolygon 
GdImage $image
                                              array 
$points
                                                  
int $num_points
                                                  
int $color )

where,

$image The image identifier

$points 
An ARRAY containing the 
                                 coordinates of the polygon vertices

$num_points 
The number of vertices of the polygon

$color 
The color as returned by imagecolorallocate

?>
 

  $image   


The image identifier.



  $points   


An ARRAY containing the coordinates of the polygon vertices.



  $num_points   


The number of vertices of the polygon.



  $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 065 01 imageopenpolygon.png";

$id_polig imagecreatefrompng($base_img);

$colorln imagecolorallocate($id_polig25500);

$star = [191,90209,142264,143220,177
                         
236,230191,199146,231
                         
161,177119,143172,143]; 
                         
$starv = (count($star)/2);

imageantialias($id_polig1);

$polystar 
imageopenpolygon($id_polig$star$starv$colorln);

$quality 9;

$filter 4
// PNG_FILTER_PAETH

imagepng($id_polig$dest_img$quality$filter);

echo 
$dest_img?>
<br><br><img src="<?php echo $dest_img?>
alt="<?php echo $dest_img?>"> 


 RESULT   

PNG 065 01 imageopenpolygon.png

PNG 065 01 imageopenpolygon.png apr