Jump to content

I need help with imagegrabwindow() ...


jonaofarc

Recommended Posts

Basically Iam trying to use the imagegrabwindow() however when this scripts run were does it save the PNG to? nothing seems to happen and no file is added in the files directory.

 

 

<?php

$browser = new COM("InternetExplorer.Application");

$handle = $browser->HWND;

$browser->Visible = true;

$browser->Navigate("http://www.libgd.org");

 

/* Still working? */

while ($browser->Busy) {

    com_message_pump(4000);

}

$im = imagegrabwindow($handle, 0);

$browser->Quit();

imagepng($im, "iesnap.png");

?>

Link to comment
https://forums.phpfreaks.com/topic/150061-i-need-help-with-imagegrabwindow/
Share on other sites

Hrmmm, I guess check if stuff is failing for some reason or other.

 

 

First, I would change the error_reporting and display_errors.

 

error_reporting(E_ALL);

ini_set('display_errors', '1');

 

 

Then, you could check the return of the functions to make sure neither of them are failing.

 

 

$im = imagegrabwindow($handle, 0);

$browser->Quit();

if($im === FALSE) {

    echo 'Error grabbing window shot.';

}

else {

    if(!imagepng($im, "iesnap.png")) {

        echo "Error calling imagepng().";

    }

}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.