Printing dynamic Images

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
fwhenry
Forum Newbie
Posts: 3
Joined: Mon Sep 15, 2003 8:19 pm

Printing dynamic Images

Post 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.
fwhenry
Forum Newbie
Posts: 3
Joined: Mon Sep 15, 2003 8:19 pm

Post 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.
pootergeist
Forum Contributor
Posts: 273
Joined: Thu Feb 27, 2003 7:22 am
Location: UK

Post 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.
fwhenry
Forum Newbie
Posts: 3
Joined: Mon Sep 15, 2003 8:19 pm

Post 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!
Post Reply