Page 1 of 1

Printing dynamic Images

Posted: Mon Sep 15, 2003 8:19 pm
by fwhenry
Hey all,

I wrote a simple script to graph values from my database using imagecreate, imageline, etc. This works great but I can't figure out how the client can print out the resulting graph. I don't want to screen grab <Prt Sc> since I don't want the browser window, only the graph.

Thanks for your help.

Posted: Mon Sep 15, 2003 8:38 pm
by fwhenry
Let me clearify one thing. When I try to print (File->Print) I get my HTML forms printed. The script starts off with forms to querie the client for what data to generate graphs from (Date, time etc.). The script is then resubmitted (PHP_SELF) and the graphing logic is activated. File -> Print results in the original HTML form page to print but the graph image is not printed. Could the imagedestroy be the cause? Maybe I need to delay this?

...I tried removing imagedestroy. Now the printer prints out an icon with a red X. Like you'd get while surfing and need to right click->Show Picture to download it. Any ideas? Sorry for for being a PITA.

Posted: Tue Sep 16, 2003 4:00 am
by pootergeist
You might try crontab creation of the graph into a staticly saved image and just referencing that on the output page -
Either that or save a server copy when the graph is created an have a [printable version] link on the page that links to a similar page using the static image.

Posted: Tue Sep 16, 2003 4:59 pm
by fwhenry
pootergeist,

Thanks for your help. I'm not sure what a crontab is but your other suggestion worked well. I just added the file name to imagepng and the resulting file is printable. Thanks again!