|
|
trying to draw simple images/charts from web server
|
|
|
|
Mac Elite
Join Date: Feb 2000
Location: RTP, NC
Status:
Offline
|
|
I've got a web tool that I've written that helps my group debug things from our voluminous debug logs. I've done some nice HTML stuff, but I'd really like to draw some histograms and other simple images.
Most of my digging has led me to the GD libraries, which are not installed by default. If necessary, I'll do that, though it doesn't look fun.
Is there something simpler that I'm missing? Something that's already installed as part of Mac OS X Server (Snow Leopard)? I want to draw some straight lines of varying lengths and colors on an XY axis. Ideally, I'd like to have an imagemap, too, with tooltips and hot areas (clickable).
Thoughts?
|
Late 2012 27" iMac 3.4GHz Intel Core i7, 24GB RAM, 3TB Fusion drive
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: Jul 2002
Status:
Offline
|
|
OS X Server comes with PHP and GD library module by default. You can do all your basic drawing needs in PHP. Like so:
Code:
<?php
header ("Content-type: image/png");
$im = @imagecreatetruecolor(120, 20)
or die("Cannot Initialize new GD image stream");
$line_color = imagecolorallocate($im, 233, 14, 91);
imageline($im, 0, 0, 120, 20, $line_color);
imagepng($im);
imagedestroy($im);
?>
Plenty of samples online, and it's very extensive. olePigeon's Yahtzee sig, for example. I did that with OS X's (Leopard) bundled PHP. Generates random dice and calculates your Yahtzee score for that hand. Would be pretty straight forward to adapt it to generating charts or whatever.
(* Reload your browser window to get a new hand below: *)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|