ইমেজপেনপলিগন() পিএইচপি-তে একটি অন্তর্নির্মিত ফাংশন যা একটি প্রদত্ত চিত্রে একটি খোলা বহুভুজ আঁকতে ব্যবহৃত হয়৷
সিনট্যাক্স
bool imageopenpolygon(resource $image,array $points,int $num_points,int $color)
পরামিতি
ইমেজপেনপলিগন() চারটি ভিন্ন প্যারামিটার লাগে:$image, $points, $num_points এবং$color।
-
$ছবি - কাজ করার জন্য ইমেজ রিসোর্স নির্দিষ্ট করে।
-
$ছবি - কাজ করার জন্য ইমেজ রিসোর্স নির্দিষ্ট করে।
-
$পয়েন্ট − বহুভুজের বিন্দু নির্দিষ্ট করে।
-
$num_points - পয়েন্টের সংখ্যা নির্দিষ্ট করে। বিন্দুর মোট সংখ্যা কমপক্ষে তিনটি হতে হবে।
-
$color − এই প্যারামিটারটি বহুভুজের রঙ নির্দিষ্ট করে।
রিটার্ন মান
ইমেজপেনপলিগন() সাফল্যের উপর সত্য এবং ব্যর্থতার উপর মিথ্যা ফেরত দেয়।
উদাহরণ 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);
?> আউটপুট
