jonaofarc Posted March 18, 2009 Share Posted March 18, 2009 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"); ?> Quote Link to comment Share on other sites More sharing options...
corbin Posted March 18, 2009 Share Posted March 18, 2009 iesnap.png? You aren't trying to run that under linux are you? Also, you might have to enable the Apache service to interact with the desktop if you're running that under Apache with PHP as a module. Quote Link to comment Share on other sites More sharing options...
jonaofarc Posted March 18, 2009 Author Share Posted March 18, 2009 no I ran in on windows XP but nothing happens .. how do you allow ? or what code to I put in the httpd.conf to allow interaction with the desktop? Quote Link to comment Share on other sites More sharing options...
corbin Posted March 18, 2009 Share Posted March 18, 2009 Windows Logo + R. Type in "services.msc" and hit enter. Find the Apache service in the list that comes up. Right click on it and hit properties. Click on the "Log On" tab. Click the "Allow service to interact with desktop" box. Quote Link to comment Share on other sites More sharing options...
jonaofarc Posted March 18, 2009 Author Share Posted March 18, 2009 corbin.. any ideas where can I find the saved images? I did as you asked regarding the apache Quote Link to comment Share on other sites More sharing options...
corbin Posted March 18, 2009 Share Posted March 18, 2009 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()."; } } Quote Link to comment Share on other sites More sharing options...
jonaofarc Posted March 19, 2009 Author Share Posted March 19, 2009 Fatal error: Call to undefined function imagegrabwindow() so that happens because gdlib is comment in the php file so I tried to uncomment it however in my php.ini file on my wamp server there is no gdlib 2 dll to uncomment... Quote Link to comment Share on other sites More sharing options...
corbin Posted March 19, 2009 Share Posted March 19, 2009 Does php_gd2.dll exist in your extensions folder? If so, just add extension=php_gd2.dll In php.ini. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.