test.php: addBorder("black"); $p->renderImage(); ?> graph.php: im = imagecreate($x_size, $y_size); $this->x_size = $x_size; $this->y_size = $y_size; } public function addBorder($color) { imageline($this->im, 0, 0, $this->x_size, 0, getColor($color)); imageline($this->im, $this->x_size, 0, $this->x_size, $this->y_size, getColor($color)); imageline($this->im, $this->x_size, $this->y_size, 0, $this->y_size, getColor($color)); imageline($this->im, 0, $this->y_size, 0, 0, getColor($color)); } public function renderImage() { imagepng($this->im); imagedestroy($this->im); } } ?>