इमेजपॉलीगॉन () फ़ंक्शन का उपयोग बहुभुज बनाने के लिए किया जाता है।
वाक्यविन्यास
bool imagepolygon( $img, $points, $num_points, $color)
पैरामीटर
- $img :imagecreatetruecolor() फंक्शन के साथ एक ब्लैंक इमेज बनाएं।
- $अंक :बहुभुज के शीर्षों वाली एक सरणी।
- $num_points :बहुभुज में शीर्षों की कुल संख्या।
- $रंग :एक रंग पहचानकर्ता जिसे imagecolorallocate() फ़ंक्शन के साथ बनाया गया है।
वापसी
imagepolygon() फ़ंक्शन सफलता पर TRUE या विफलता पर FALSE लौटाता है।
उदाहरण
निम्नलिखित एक उदाहरण है:
<?php
$img = imagecreatetruecolor(400, 300);
$color = imagecolorallocate($img, 120, 160, 190);
$bgcolor = imagecolorallocate($img, 10, 100, 50);
imagefill($img, 0, 0, $bgcolor);
imagepolygon($img, array(
50, 50,
150, 200,
340, 200
),
3,
$color);
header('Content-type: image/png');
imagepng($img);
imagedestroy($img);
?> आउटपुट
निम्न आउटपुट है:
