From 1bd9f70db988ed36b4eedb18b97d6861b4715fac Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 20 Feb 2006 20:07:58 +0000 Subject: [PATCH] Actually return the graphing data instead of just printing it out to the browser --- graph_pie.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/graph_pie.php b/graph_pie.php index 2508e29..2695e28 100644 --- a/graph_pie.php +++ b/graph_pie.php @@ -180,9 +180,17 @@ class Graph_Pie imageline($this->image, $this->dimensions['width'] - $graphpadding, $graphstart, $this->dimensions['width'] - $graphpadding, $legy, $colours['black']); // right } + ob_start(); imagepng($this->image); + $data = ob_get_contents(); + if ($data === false) + { + $data = ob_get_clean(); + } + ob_clean(); + ob_end_clean(); - //return $output; + return $data; } // ################################################################### @@ -211,7 +219,9 @@ class Graph_Pie $this->dimensions['width'] /= $scale; $this->dimensions['height'] /= $scale; } - + + imagedestroy($this->image); + $this->image = imagecreate($this->dimensions['width'], $this->dimensions['height']); } -- 2.22.5