Page 1 of 1

bar graph

Posted: Fri Jan 07, 2005 9:33 pm
by Joe
I am fairly new to the image functions used within PHP and I recently got a simple script which creates a .png image of a bar graph showing values and I manipulated it slightly so it reads values from the MySQL database. Now it uses imagepng() but I am not sure how I can save the file on the remote disk or if it is even possible?.

Fullest Regards


Joe

Posted: Fri Jan 07, 2005 9:41 pm
by feyd
remote disk, being on the server, or on the client?

on the server, you can pass the filename parameter of the [php_man]imagepng()[/php_man] function.

If you want to save it on the client, there's allowing them to choose to save it.. and forcing the save dialog box to display. For forcing the download, read the [php_man]header()[/php_man] documentation. For display, you'll need a header call to tell the client you are sending it an png image.

Posted: Fri Jan 07, 2005 9:44 pm
by Joe

Code: Select all

$image = imagecreatefrompng("test.png");
imagepng($image);
Adding the above to the code says that the image could not be created because there is errors. I already tried. I am not sure that passing file related functions in an image creation is wise so I am stuck for solutions.

Posted: Fri Jan 07, 2005 9:53 pm
by Joe
Never mind I found a solution. Thanks anyway.