public function actionScreenShot() { $word = new COM("word.application") or die("Cannot start word for you"); print "Loaded word version ({$word->Version})n"; $word->visible = 1; $word->Documents->Add(); $word->Selection->Typetext("Dit is een test"); //$word->Documents[1]->SaveAs("burb ofzo.doc"); UtilHelper::dump($word); $word->Quit(); die; $browser = new COM("InternetExplorer.Application"); UtilHelper::dump($browser); die; $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"); imagedestroy($im); }
private function outputImage($domain) { var_dump('start:' . memory_get_usage()); $browser = new COM("InternetExplorer.Application"); $handle = $browser->HWND; $browser->Visible = true; $browser->FullScreen = true; $url = "http://www." . $domain; $file = "../metadata/screen/3000/" . $domain . ".png"; echo $url . "\n"; $browser->Navigate($url); while ($browser->Busy) { com_message_pump(1000); } if (!file_exists($file)) { $im = imagegrabwindow($handle, 0); imagepng($im, $file); imagedestroy($im); } $fp = fopen($file, 'rb'); fpassthru($fp); $browser->Quit(); var_dump('free:' . memory_get_usage()); }
protected function get_url_pic2($url, $file, $scroll = 420) { $browser = new COM("InternetExplorer.Application"); $handle = $browser->HWND; $browser->Visible = true; $browser->Width = 2900; $browser->Height = 9780; $browser->Left = 2780; $browser->Top = 2780; $browser->menubar = 0; $browser->AddressBar = 0; $browser->StatusBar = 0; $browser->Navigate($url); $browser->ToolBar = 0; /* Still working? */ while ($browser->Busy) { com_message_pump(4000); } $browser->document->parentWindow->scrollTo(0, $scroll); $im = imagegrabwindow($handle, 0); $browser->Quit(); imagepng($im, ROOT . $file); imagedestroy($im); }
<?php /** * * @authors Your Name (you@example.org) * @date 2015-07-30 13:48:06 * @version $Id$ */ $browser = new COM("InternetExplorer.Application"); $handle = $browser->HWND; $browser->Visible = true; $browser->FullScreen = true; $browser->Navigate("http://www.okbase.net"); /* 仍旧在运行? */ while ($browser->Busy) { com_message_pump(4000); } /* 抓屏 */ $im = imagegrabwindow($handle, 0); $browser->Quit(); /* 保存为png */ imagepng($im, "okbase.png");
public function windowDisplay(int $window, int $clientArea = 0) : InternalGD { $this->canvas = imagegrabwindow($window, $clientArea); return $this; }
public function windowDisplay($window = 0, $clientArea = 0) { $this->canvas = imagegrabwindow($window, $clientArea); return $this; }