imagepolygon
imagepolygon
Draws a polygon
Signature as of PHP 8.0.0 (not supported with named arguments)
bool **imagepolygon** GdImage $image array $points int $color
Alternative signature (deprecated as of PHP 8.1.0)
bool **imagepolygon** GdImage $image array $points int $num_points int $color
creates a polygon in the given
.
imagepolygon``image
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
imagepolygon($image, array(
0, 0,
100, 200,
300, 200
),
$col_poly);
// Output the picture to the browser
header('Content-type: image/png');
imagepng($image);
?>
imagefilledpolygon``imageopenpolygon``imagecreate``imagecreatetruecolor