haveacigar
03-26-2007, 11:58 PM
Hey, I'm staring a new project and i am trying to make an poll, which is fine, but what i need to do is have the results outputted into an image.
I havent been able to find anything like this on google so does anyone have any thoughts?
Cheers
Ciggy
Fumigator
03-27-2007, 12:23 AM
PHP has an image library called the GD library. The PHP manual can get you started on this page here (http://us2.php.net/manual/en/ref.image.php) and this one here (http://us2.php.net/manual/en/function.imagecreate.php).
aedrin
03-27-2007, 03:00 PM
The easiest way is to simply make a graphic that is the height of your percentage bars.
Then echo out the width of the image as the percentage.
foreach ($results as $result) {
echo '<img src="bar.gif" width="'.$result['percentage'].'" />';
}