If you like to save the image directly to a file instead of streaming it back to the browser then you just have to specify an absolute filename in the final call to Graph::Stroke(), i.e.
$graph->
Stroke(
"/usr/home/peter/images/result2002.png");
Please note that the user running as Apache/PHP must have write access to the specified directory.
There are also two predefined filenames which have special meaning.
$handle =
$graph->Stroke(_IMG_HANDLER
);