K. Schweigert - 2006-08-24 02:57:12
I am trying to use the class to return an image by referencing it like:
echo "<img src=\"piegraph.image.php?userid=" . $userid . "&titleid=" . $titleid . "\">";
In piegraph.image.php I take the supplied GET values and use them as arguments to a function that queries the database and returns an array.
Code snippet:
require("piegraph.class.php");
require("functions.php");
$a = array();
$a = get_my_issues_in_title($userid,$titleid);
$pie = new PieGraph(200, 100, array(3,127));
$pie->setColors(array("#19a000","#e5e5e5"));
$pie->setLegends(array("$userid","$titleid"));
$pie->DisplayCreationTime();
$pie->set3dHeight(15);
$pie->display();
If I hit "piegraph.image.php?userid=1&titleid=1" it returns "The image cannot be displayed, because it contains errors." However, if I comment out the line to get_my_issues_in_title() it renders the graph perfectly. The legend even has the values passed to it from the GET variables.
Thinking my function might be sending something that was corrupting the image, I put a header() redirect after each line and stepped through it and the page redirected each time; didn't get the "headers have been already sent" error.
I don't understand how this one line could be crashing the class.
Can anyone help me figure it out?
-ken