Jim Lawrence
accessd at shaw.ca
Sat Sep 11 11:54:57 CDT 2010
Hi Stuart: That's awesome. You would not believe how many lines of JavaScript code I have used to create graphs for clients. This could make the job almost pleasant. :-) Jim -----Original Message----- From: dba-tech-bounces at databaseadvisors.com [mailto:dba-tech-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan Sent: Friday, September 10, 2010 9:32 PM To: Discussion of Hardware and Software issues Subject: Re: [dba-Tech] So how do you automate imaging? On 11 Sep 2010 at 14:06, Stuart McLachlan wrote: > A quick look at http://www.php.net/manual/en/ref.image.php shows that > it doesn't just manipulate existing images, it lets you create images > with text, line, arc etc functions so you could use it to create > graphs/charts on the fly in your web page from various data sources. > Just tried one of the examples, it's really neat. The entire contents of the file http://www.lexacorp.com.pg/imagetest.php follows, take a look at the result. -- Stuart <?php // create image $image = imagecreatetruecolor(100, 100); // allocate some colors $white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF); $gray = imagecolorallocate($image, 0xC0, 0xC0, 0xC0); $darkgray = imagecolorallocate($image, 0x90, 0x90, 0x90); $navy = imagecolorallocate($image, 0x00, 0x00, 0x80); $darknavy = imagecolorallocate($image, 0x00, 0x00, 0x50); $red = imagecolorallocate($image, 0xFF, 0x00, 0x00); $darkred = imagecolorallocate($image, 0x90, 0x00, 0x00); // make the 3D effect for ($i = 60; $i > 50; $i--) { imagefilledarc($image, 50, $i, 100, 50, 0, 45, $darknavy, IMG_ARC_PIE); imagefilledarc($image, 50, $i, 100, 50, 45, 75 , $darkgray, IMG_ARC_PIE); imagefilledarc($image, 50, $i, 100, 50, 75, 360 , $darkred, IMG_ARC_PIE); } imagefilledarc($image, 50, 50, 100, 50, 0, 45, $navy, IMG_ARC_PIE); imagefilledarc($image, 50, 50, 100, 50, 45, 75 , $gray, IMG_ARC_PIE); imagefilledarc($image, 50, 50, 100, 50, 75, 360 , $red, IMG_ARC_PIE); // flush image header('Content-type: image/png'); imagepng($image); imagedestroy($image); ?> _______________________________________________ dba-Tech mailing list dba-Tech at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-tech Website: http://www.databaseadvisors.com