Forum Moderators: coopster
which i must pass through the page first before anything is passed. So I put the header function the first thing on the page, then put some print() functions the end of the page. But it still doesn't allow me to print anything. Is it just not possible to use print() when I use those image functions? Thank You.
PHP image functions don't allow me to use print()
no matter where i put it
You answered your question yourself...
print is not an image function, it's a text function. Image Functions [php.net]
I want something like this:
-------------------------------------
the poll title here in words
the pie graph here
the total # of votes here in words
-------------------------------------
the pie graph is working fine, now I want to put the title in words somewhere above the pie graph, since it's just a title, i don't want to make that into an image, so I tried using the print() to print the title out, but didn't work. same with the total # of votes in words. I saw it on other sites, where they are able to do what I want, but of course, I don't know how they did it.
When you use php to produce images, think like this: the php script is the image. You put the image on your page like any other image, except the extension is a php extension instead of the usual .jpg or .png or whatever - like this:
<img src="phpimagescript.php" alt="image generated by php" />
So the image part is a whole separate script, a separate file, from the part of your php that's producing the HTML page with text.
print() and echo() output things - but images consist of binary output. So in your image script, you put the header there, like you mention, and then you just use image functions, and no echo or print (unless you're a real image genious and know how to insert the right binary stuff at the right place). 'Text' you see on images is not like text on webpages - it's just pixel combos, and in binary format.
What you want to use is
imagestring()or
imagettftext().