note 108757 deleted from function.imagepolygon by danbrown

From: Date: Wed, 23 May 2012 13:51:59 +0000
Subject: note 108757 deleted from function.imagepolygon by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-188158@lists.php.net to get a copy of this message
Note Submitter: licson0729 at gmail dot com ---- Here's a function to draw a n-sided star: <?php function drawStar($img,$x,$y,$radius,$sides,$color,$spikness=0.5) { $point =array(); $t = 0; for($a = 0;$a <= 360;$a += 360/($sides*2)) { $t++; if($t % 2 == 0) { $point[] = $x + ($radius * $spikness) * cos(deg2rad($a)); $point[] = $y + ($radius * $spikness) * sin(deg2rad($a)); }else{ $point[] = $x + $radius * cos(deg2rad($a)); $point[] = $y + $radius * sin(deg2rad($a)); } } return imagepolygon($img,$point,$sides*2,$color); } ?>

« previous php.notes (#188158) next »