Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Aug 2006
    Posts
    97
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP poll with image output

    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

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    PHP has an image library called the GD library. The PHP manual can get you started on this page here and this one here.

  • #3
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    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.

    PHP Code:
    foreach ($results as $result) {
        echo 
    '<img src="bar.gif" width="'.$result['percentage'].'" />';



  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •