Php site image grab

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
Lucvh
Forum Newbie
Posts: 5
Joined: Thu Jun 02, 2005 5:08 pm

Php site image grab

Post by Lucvh »

Is there any way i could code somethign that would visit the imputted url, and output a section of the page into an image gd jpeg?
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

you want to capture the entire page as a image as like take a screen shot of the webpage then posting that on your website? i really dont think that is possible because you can only open another website as a html file perdy much but you might be able to just compress everything into a real small area then display that?
Syranide
Forum Contributor
Posts: 281
Joined: Fri May 20, 2005 3:16 pm
Location: Sweden

Post by Syranide »

something which is not available by default of my understanding... understandably as this imposes many many problems... such as the width of the page, flashanimations, javascripts and so on... I bet if you want a standalone application there is likely some project in betastage.
Lucvh
Forum Newbie
Posts: 5
Joined: Thu Jun 02, 2005 5:08 pm

Post by Lucvh »

i mean for use instead of iframes, could you make it so that it outputted just a section of text,from a page, a part before and after a certain point in the html?
User avatar
Skara
Forum Regular
Posts: 703
Joined: Sat Mar 12, 2005 7:13 pm
Location: US

Post by Skara »

shiznatix wrote:you want to capture the entire page as a image as like take a screen shot of the webpage then posting that on your website? i really dont think that is possible because you can only open another website as a html file perdy much but you might be able to just compress everything into a real small area then display that?
This is possible. My old hosting company did it. In the admin panel, there'd be a little thumbnail screenshot of your website. ;) No clue how they did it, but it was automated, as it updated instantly.
Lucvh
Forum Newbie
Posts: 5
Joined: Thu Jun 02, 2005 5:08 pm

Post by Lucvh »

yeah, that is what i would like, ahs anyone got an idea how you would code it?
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Here is an example of a site that does it:

http://www.whois.sc/devnetwork.net

Still no idea how it is done. Anyone?
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

hawleyjr wrote:Here is an example of a site that does it:

http://www.whois.sc/devnetwork.net

Still no idea how it is done. Anyone?
I'm guessing they actually open a graphical browser (automated) and take a screenshot/dump from that. I suspect there may be a commandline version for one of the opensource browsers, like konqueror that allows it. Like:

Code: Select all

konqueror http://www.example.com --dump-to /home/Roja/screenshot.png
But beyond that, I have no idea.

Also, they are running mod_perl, and use url rewriting, so we can't be sure its going to php and not perl for the results.. It may be a perl module - I wouldn't be shocked.

If someone bet me $5 that they could find a perl module to BAKE COOKIES, I honestly would hesitate. They have EVERYTHING in cpan.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

If someone bet me $5 that they could find a perl module to BAKE COOKIES, I honestly would hesitate. They have EVERYTHING in cpan.
Ah, that'd be easy. You'd just have to define a protocol for the oven and then set up the physical connection... wait... that's not so easy. :lol:

If konquerer can do it, and it can be done completely via commandline, I don't see why you can't just plug PHP into it. Do some research, we shall, hmm?
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

I've written a little script that does this... But it was a major pita because it required that IE got focus... So a solution on a machine with X seems better :)

http://timvw.madoka.be/programming/vbs/ ... ot.vbs.txt
User avatar
Skara
Forum Regular
Posts: 703
Joined: Sat Mar 12, 2005 7:13 pm
Location: US

Post by Skara »

which only works on windows. >.>

For linux, open up a konqueror (/firefox/whatever) window and use

Code: Select all

import -window root screenshot.jpg
for the whole screen. Haven't figured out how to just do konqueror yet.
Post Reply