RE: [PHP] Creating images (Graphs) with php and database
| From: | Phil Messenger | Date: | Sun, 16 Jul 2000 15:35:50 +0000 |
| Subject: | RE: [PHP] Creating images (Graphs) with php and database | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-6819@lists.php.net to get a copy of this message | ||
> I was wondering is it possible to create a single image displaying a
graph
> with data I have recieved form a mysql data base. I have currently
> avoided
> using the image generation functions of php and know virtually nothing
>about
> them.
> I intend to use it to show site statistics such as hit /per month and
> percentage of users with what browser. I have currently tried using a
>table
> with solid coloured gif images and thier widths/height set by php to
> represent the amount is this a better way of doing it then trying to code
> the graphic.
>
> Any help or ideas would be apreciated.
>
> Thanks
> Jamie
Using tables like this is not generally a good ideal; each of the browsers
has their own bugs in table rendering. You may also find that people wan't
to save the image to disc, and this is obviously not possible with you
current method ;-0.
There are a couple of good pages to read:
Take a look at http://www.php.net/manual/features.images.php
and
http://www.php.net/manual/ref.image.php
This covers creating images in PHP (you will need to have the GD library
compiled in, and there are some legal issues with creating GIF's. PNG's and
JPEGS are fine tho..) All the functions are quite easy to use, and I think
you will find it a worthwhile investment of you time.
and for some ready made scripts
http://www.zend.com/codex.php?id=157&single=1
http://www.zend.com/codex.php?id=109&single=1
(with a page of examples made
by this script here: http://www.cjhunter.com/~nathan/graph_example.html
)
Rgrds,
Phil Messenger