
![]() |
perkiset
There was a post over at Syndk8 about someone needing to get a screen shot of a website via
PHP. I was trying to do this quite a while ago for one of my more ... erm ... advanced cloaking projects![]() ![]() So here is an abbreviation of an interesting site that I found. The entire post can be found here: http://blog.thepimp .net/index.php/post/2007/04/17/Screen-capture-with-PHP-and-GDquote To get a snapshot of a HTML page, a window or a complete screen was always something tricky to do in PHP.That's why I finally sit down and implemented imagegrabscreen and imagegrabwindow . They capture respectively the whole screen or a window (using its handle). Thanks to Edin Kadribašić, you can fetch a 5.2.x (Threadsage build only) DLL <a href="http://blog.thepimp .net/misc/gd/php_gd2-5.2-TS.zip">here</a>, simply replace thephp_gd2.dll by this one (it is what will be in 5.2.2).<>[Perk notes: This does not instruct the browser where to go, only to grab the rendered HTML found in the current IE window...]> Capture a window (IE for example) with its content <? php$browser = new COM("Inte rnetExplorer.Application");$handle = $browser->HWND; $browser->Visible = true; $browser->Navigate("http://blog.thepimp .net");/* Still working? */ while ($browser->Busy) { com_message_pump(4000); } $im = imagegrabwindow($handle, 0); $browser->Quit(); imagepng($im, "iesnap.png"); ?> IE in fullscreen mode <? php$browser = new COM("Inte rnetExplorer.Application");$handle = $browser->HWND; $browser->Visible = true; $browser->FullScreen = true; $browser->Navigate("http://blog.thepimp .net");/* Is it completely loaded? (be aware of frames!)*/ while ($browser->Busy) { com_message_pump(4000); } $im = imagegrabwindow($handle, 0); $browser->Quit(); imagepng($im, "iesnap.png"); ?> vsloathe
Don't quote me, but I'm pretty sure you can do it straight away with imagick out of the box (so to speak, no box since it's FOSS
![]() |

Thread Categories

![]() |
![]() |
Best of The Cache Home |
![]() |
![]() |
Search The Cache |
- Ajax
- Apache & mod_rewrite
- BlackHat SEO & Web Stuff
- C/++/#, Pascal etc.
- Database Stuff
- General & Non-Technical Discussion
- General programming, learning to code
- Javascript Discussions & Code
- Linux Related
- Mac, iPhone & OS-X Stuff
- Miscellaneous
- MS Windows Related
- PERL & Python Related
- PHP: Questions & Discussion
- PHP: Techniques, Classes & Examples
- Regular Expressions
- Uncategorized Threads