imageopenpolygon() PHP में एक इनबिल्ट फंक्शन है जिसका उपयोग किसी दिए गए इमेज पर एक ओपन पॉलीगॉन बनाने के लिए किया जाता है।
सिंटैक्स
bool imageopenpolygon(resource $image,array $points,int $num_points,int $color)
पैरामीटर
imageopenpolygon() चार अलग-अलग पैरामीटर लेता है:$image, $points, $num_points and$color.
-
$छवि - काम करने के लिए छवि संसाधन निर्दिष्ट करता है।
-
$छवि - काम करने के लिए छवि संसाधन निर्दिष्ट करता है।
-
$अंक − बहुभुज के बिंदु निर्दिष्ट करता है।
-
$num_points - अंकों की संख्या निर्दिष्ट करता है। (कोने) अंकों की कुल संख्या कम से कम तीन होनी चाहिए।
-
$रंग - यह पैरामीटर बहुभुज के रंग को निर्दिष्ट करता है।
रिटर्न वैल्यू
imageopenpolygon() सफलता पर सही और असफलता पर गलत लौटाता है।
उदाहरण 1
<?php
// Create a blank image using imagecreatetruecolor() function.
$img = imagecreatetruecolor(700, 300);
// Allocate a color for the polygon
$col_poly = imagecolorallocate($img, 0, 255, 0);
// Draw the polygon
imageopenpolygon($img, array(
0, 0,
100, 200,
400, 200
),
3,
$col_poly);
// Output the picture to the browser
header('Content-type: image/png');
imagepng($img);
imagedestroy($img);
?> आउटपुट

उदाहरण 2
<?php
// Create a blank image using imagecreatetruecolor() function.
$image = imagecreatetruecolor(700, 300);
// allocate the colors
$blue = imagecolorallocate($image, 0, 255, 255);
// Six points of the array
$points = array(
60, 130,
130, 230,
280, 230,
350, 130,
210, 30,
60, 130
);
// Create a polygon
imageopenpolygon($image, $points, 6, $blue);
// Output to the browser
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);
?> आउटपुट
