You need to create the image files in a directory that is in your web site's document root. Your last comment indicates that it is probably in /var/www. Therefore, if you create a folder in /var/www, and call it, say, 'graph_files', then you want to write your image files to /var/www/graph_files, and then when you send your web page to the browser, the image tag should be <img src="graph_files/<filename>">