PHP.nl

imageopenpolygon

imageopenpolygon

Draws an open polygon

Signature as of PHP 8.0.0 (not supported with named arguments)

bool **imageopenpolygon** GdImage $image array $points int $color

Alternative signature (deprecated as of PHP 8.1.0)

bool **imageopenpolygon** GdImage $image array $points int $num_points int $color
draws an open polygon on the given

. Contrary to , no line is drawn between the last and the first point. imageopenpolygon``image``imagepolygon

pointsAn array containing the polygon's vertices, e.g.:

num_pointsTotal number of points (vertices), which must be at least 3.

   If this parameter is omitted as per the second signature, 
   must have an even number of elements, and  is
   assumed to be .
  `points``num_points``count($points)/2`

colorgd.identifier.color

return.success

Voorbeeld: example

<?php
// Create a blank image
$image = imagecreatetruecolor(400, 300);

// Allocate a color for the polygon
$col_poly = imagecolorallocate($image, 255, 255, 255);

// Draw the polygon
imageopenpolygon($image, array(
        0,   0,
        100, 200,
        300, 200
    ),
    $col_poly);

// Output the picture to the browser
header('Content-type: image/png');

imagepng($image);
?>

imagepolygon