note 58520 added to ref.image

From: Date: Mon, 07 Nov 2005 10:22:14 +0000
Subject: note 58520 added to ref.image
Groups: php.notes 
Request: Send a blank email to php-notes+get-98185@lists.php.net to get a copy of this message
Generate a bar chart on-the-fly through php image functions. <br> code for barchart.php <? // Add values to the graph $graphValues=array(0,80,23,11,190,245,50,80,111,240,55); // Define .PNG image header("Content-type: image/png"); $imgWidth=250; $imgHeight=250; // Create image and define colors $image=imagecreate($imgWidth, $imgHeight); $colorWhite=imagecolorallocate($image, 255, 255, 255); $colorGrey=imagecolorallocate($image, 192, 192, 192); $colorDarkBlue=imagecolorallocate($image, 104, 157, 228); $colorLightBlue=imagecolorallocate($image, 184, 212, 250); // Create border around image imageline($image, 0, 0, 0, 250, $colorGrey); imageline($image, 0, 0, 250, 0, $colorGrey); imageline($image, 249, 0, 249, 249, $colorGrey); imageline($image, 0, 249, 249, 249, $colorGrey); // Create grid for ($i=1; $i<11; $i++){ imageline($image, $i*25, 0, $i*25, 255, $colorGrey); imageline($image, 0, $i*25, 255, $i*25, $colorGrey); } // Create bar charts for ($i=0; $i<10; $i++){ imagefilledrectangle($image, $i*25, (250-$graphValues[$i]), ($i+1)*25, 250, $colorDarkBlue); imagefilledrectangle($image, ($i*25)+1, (250-$graphValues[$i])+1, (($i+1)*25)-5, 248, $colorLightBlue); } // Output graph and clear image from memory imagepng($image); imagedestroy($image); ?> Thanks and regards, skumar k. ---- Manual Page -- http://www.php.net/manual/en/ref.image.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+58520 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58520&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58520&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58520&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58520&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58520&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58520&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58520&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+58520&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#98185) next »