Forum Moderators: mack

Message Too Old, No Replies

saving files using gd and ImagePNG

         

cloudwarrior

12:41 pm on May 1, 2008 (gmt 0)

10+ Year Member



Hello
i hope someone and help with my first post.
i am trying to save graph png images using "postgraph.class.php" (a free resource) which uses gd.

The php script that calls the postgraph.class.php uses this:-

$graph->printImage();

the funcion in "postgraph.class.php" is:-

function printImage() {
header( "Content-type: image/png" );
ImagePNG($this->img);
}

what i would like to do is to save the file using ImagePNG() use the script to generate three more graphs and they will be displayed on a web page.
i can change the printImage function to save a file, but this would only enable me to save the one file and not the four that i want

can someone please help me out .
cheers :-)

coopster

9:27 pm on May 1, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, cloudwarrior.

Rather than change the printImage function you could also add a new function, something like saveImage() or what ever you decide to name it. Then, all you need to do is call that function for each instance of your class (which is likely each photo in your case).

cloudwarrior

10:18 am on May 2, 2008 (gmt 0)

10+ Year Member



Hi Coopstar
Thanks for the help.
why are the best answers always the simplest!
i have got it working, i just need to set it up so that it can generate four different images.
cheers