note 61310 added to function.imagefilledarc

From: Date: Tue, 31 Jan 2006 10:53:03 +0000
Subject: note 61310 added to function.imagefilledarc
Groups: php.notes 
Request: Send a blank email to php-notes+get-102758@lists.php.net to get a copy of this message
The previous example does not work. Try those modifications and you will have the expected results : <? $Randomized = rand(1,20); for($i=0;$i<=$Randomized;$i++){$data[$i]=rand(2,20);};//full array with garbage. $imgx='200';$imgy='200';//Set Image Size. ImageX,ImageY $cx = '100';$cy ='50'; //Set Pie Postition. CenterX,CenterY $sx = '200';$sy='100';$sz ='20';// Set Size-dimensions. SizeX,SizeY,SizeZ $data_sum = array_sum($data); //convert to angles. for($i=0;$i<=$Randomized;$i++){ $angle[$i] = (($data[$i] / $data_sum) * 360); $angle_sum[$i] = array_sum($angle); }; $im = imagecreate ($imgx,$imgy); $background = imagecolorallocate($im, 255, 255, 255); //Random colors. for($i=0;$i<=$Randomized;$i++){ $r=rand(100,255);$g=rand(100,255);$b=rand(100,255); $colors[$i] = imagecolorallocate($im,$r,$g,$b); $colord[$i] = imagecolorallocate($im,($r/2),($g/2),($b/2)); } //3D effect. for($z=1;$z<=$sz;$z++){ for($i=1;$i<=$Randomized;$i++){ imagefilledarc($im,$cx,($cy+$sz)-$z,$sx,$sy,$angle_sum[$i-1] ,$angle_sum[$i],$colord[$i],IMG_ARC_PIE); }; }; //Top pie. for($i=1;$i<=$Randomized;$i++){ imagefilledarc($im,$cx,$cy,$sx,$sy,$angle_sum[$i-1] ,$angle_sum[$i], $colors[$i], IMG_ARC_PIE); }; //Output. header('Content-type: image/png'); imagepng($im); imagedestroy($im); ?> ---- Server IP: 64.71.164.2 Probable Submitter: 62.23.212.62 (proxied: 1.1 netcache-vz (NetCache NetApp/5.6.2R1D9), 1.1 netcache-vz (NetCache NetApp/5.6.2R1D9)) ---- Manual Page -- http://www.php.net/manual/en/function.imagefilledarc.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+61310 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61310&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61310&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61310&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61310&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61310&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61310&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61310&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+61310&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#102758) next »