note 10897 deleted from function.imagepolygon by didou
| From: | didou@php.net | Date: | Fri, 15 Aug 2003 22:04:26 +0000 |
| Subject: | note 10897 deleted from function.imagepolygon by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-54259@lists.php.net to get a copy of this message | ||
Note Submitter: ecofarm@mullum.com.au
----
Create an array of points for the polygon... example script follows
(note you may have to change png to gif or whatever image format your version of php is configured
with)
<pre>
<?php
Header ("Content-type: image/png");
/////// set up array of points for polygon ///////
$a = array(
"0" => "40", // x1
"1" => "50", // y1
"2" => "20", // x2
"3" => "240", // y2
"4" => "60", // x3
"5" => "60", // y3
"6" => "240", // x4
"7" => "20", // y4
"8" => "50", // x5
"9" => "40", // y5
"10" => "10", // x6
"11" => "10", // y6
);
///// create canvas /////
$im = ImageCreate (250, 250);
//define colors.. first color declared is set as background
$white = ImageColorAllocate ($im, 255, 255, 255);
$blue = ImageColorAllocate ($im, 0, 0, 255);
// draw a polygon
ImageFilledPolygon ($im, $a, 6, $blue );
// create the image
ImagePng ($im);
// destroy the image to free memory
ImageDestroy ($im);
?>
</pre>