NYCPHP Meetup

NYPHP.org

[nycphp-talk] Website Screenshots from PHP

Richard Safran rsafran at thesafrans.com
Wed Nov 15 12:55:26 EST 2006


A better solution is to use Firefox:

1. Run Xvfb instead of a real X server so that you don't need to attach to a monitor.
2. Run firefox supplying the URL as a command-line parm.
3. Run xwininfo to find the proper root window.
4. Run import from imagemagick to get an image of that window.

Piece of cake ;)

It's actually a little PITA to get working, but it makes for a reasonable 
server/unattended solution.  Works best in Perl, but you could accept the request in PHP, 
pass it on to the Perl script, and wait asynchronously for the results.  Usually you 
display a dummy image saying "we're working on this" when the first request for a given 
URL comes in, then the real thing once it's available.  A little PHP script could be used 
in the <img> tag, essentially as a "404" handler.

Did any of this make sense?

-- 
Richard Safran
CTO
LinkExperts, LLC
118 East 28th Street
New York, NY 10016
(212) 213-6251 x135
http://www.linkexperts.com/
rsafran at linkexperts.com


Craig Thomas wrote:
> Joseph Crawford wrote:
>> Hey guys,
>>
>> I found something today that was rather interesting and i would like to 
>> feed my brain and figure out how to do something like this
>>
>> http://webdesignbook.net/snapper.php?url=http://www.josephcrawford.com&full 
>> <http://webdesignbook.net/snapper.php?url=http://www.josephcrawford.com&full>
>>
>> you can change the url in the querystring and it will take a live 
>> screenshot of the page.
>>
>> Any direction on what i should research would be great.  obviously i 
>> would have to use image manipulation, but i am not sure how the screen 
>> would be captured.
>>
> 
> For *nix systems there is this:
> 
> http://khtml2png.sourceforge.net/
> 
> I can't vouch for it as I have never used it, but seems like a good 
> start if not a solution...
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
> 
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
> 
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
> 
> 



More information about the talk mailing list