PHP Capture Screen function Implementation screenshot code sharing _php Tutorial

Source: Internet
Author: User
Copy CodeThe code is as follows:
* Screen shot
$im = Imagegrabscreen ();
Imagepng ($im, "myscreenshot.png");


* Grab a window (ie for example)

$browser = new COM ("Internetexplorer.application");
$handle = $browser->hwnd;
$browser->visible = true;
$im = Imagegrabwindow ($handle);
$browser->quit ();
Imagepng ($im, "iesnap.png");
$im = Imagegrabscreen ();

Grab IE window and window contents (ie for example)

$browser = new COM ("Internetexplorer.application");
$handle = $browser->hwnd;
$browser->visible = true;
$browser->navigate ("http://www.jb51.net");

/* Still working? */
while ($browser->busy) {
Com_message_pump (4000);
}
$im = Imagegrabwindow ($handle, 0);
$browser->quit ();
Imagepng ($im, "iesnap.png");


IE Full Screen mode

$browser = new COM ("Internetexplorer.application");
$handle = $browser->hwnd;

$browser->visible = true;
$browser->fullscreen = true;
$browser->navigate ("Http://www.jb51.nett");

/* 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");
?>

Need to explain a few
1. These two methods work only under Windows,
2. Black screen solution when you--->>web server (IIS or Apache) as a Windows service, you must turn on the "Allow interaction with desktop" option. (click "Allow interaction with desktop" by clicking on service Properties, login.) (Be sure to remember to re-start Apache or other servers to be useful, I have succeeded, no doubt)
3. Requires GB library version to 2.0.34 (php5.2.2 default comes with)

http://www.bkjia.com/PHPjc/634426.html www.bkjia.com true http://www.bkjia.com/PHPjc/634426.html techarticle Copy the code as follows:? php * Screenshot $im = Imagegrabscreen (); Imagepng ($im, "myscreenshot.png"); * Grab a window (ie for example) $browser = new COM (" Internetexplorer.appli ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.