Screenshot via php

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
User avatar
Todd_Z
Forum Regular
Posts: 708
Joined: Thu Nov 25, 2004 9:53 pm
Location: U Michigan

Screenshot via php

Post by Todd_Z »

I know there have been threads about this in the past- but they kinda died out before being solved.

I have a virtual server hosted by ipower and I want to be able to enter in a url and have load a screenshot - via a php script. Is this possible... do i need to load firefox onto the machine, i don't even know if there is a monitor attached to it . Basically - i have no idea where to start.

~ Thanks in advance
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you don't need a monitor, per se, as much as you need a graphics driver that can render the UI to the graphics card, or file, or whatever.

If done right, you could probably create an extension in php that uses the Gecko rendering engine to fake a screen capture.
User avatar
Todd_Z
Forum Regular
Posts: 708
Joined: Thu Nov 25, 2004 9:53 pm
Location: U Michigan

Post by Todd_Z »

8O This is kinda a small feature to my site. I would love to have the capability, but i feel like its not worth it to start from scratch with that. Has anyone seen a script similiar to this with open source?
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

this is the only thing i ever found

http://www.thumbshots.org/
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

I've once read "WINDOWS SCRIPT HOST GRAND CRU" which had some package that allowed you to create a screenshot. So it hacked a quick script like http://timvw.madoka.be/programming/vbs/ ... ot.vbs.txt together.

Two issues:
1-) I can't find the tobtools.zip anymore.
2-) It doesn't scale to a large site (It depends on the fact that IE will have focus etc..)

In a *nix environment you don't need a monitor to make a screenshot. A working X server will do. For example, if you have firefox and imagemagick installed:

Code: Select all

firefox http://example.com -display localhost:0 & 
import -window root -display localhost:0 myfile01.pcx /home/user/website/screenshot.png
chmod o+r /home/user/website/screenshot.png
Last edited by timvw on Mon Aug 15, 2005 11:51 am, edited 1 time in total.
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

timvw wrote: In a *nix environment you don't need a monitor to make a screenshot.
Awesome! I never found the commands to pull that off. Much appreciated!
Post Reply