這篇文章主要介紹了PHP截取IE浏覽器並縮小原圖的方法,涉及PHP調用com組件實現圖像截取的相關技巧,需要的朋友可以參考下
本文實例講述了PHP截取IE浏覽器並縮小原圖的方法。分享給大家供大家參考,具體如下:
// 截取一個窗口 Capture a window (IE for example) $ie = new COM("InternetExplorer.Application"); $ie->Navigate2($webaddress); $oWSH = new COM("WScript.Shell"); while ($ie->ReadyState!=4) usleep(10000); $handle = $ie->HWND; $ie->Visible = true; while ($ie->Busy) { com_message_pump(4000); } $im = imagegrabwindow($handle, 0); $ie->Quit(); $file="public/images/".time()."iesnap.png"; imagepng($im,$file); //-------------------- $browser = new COM("InternetExplorer.Application"); $handle = $browser->HWND; $browser->Visible = true; $browser->FullScreen = true; $browser->Navigate($webaddress); while ($browser->Busy) { com_message_pump(4000); } $im = imagegrabwindow($handle, 0); $browser->Quit(); //opendir("public/images/"); $new_img=imagecreatetruecolor("206","132"); $file="public/images/".time()."ie.png"; imagecopyresampled($new_img,$im,0,0,206,132,206,142,1024,768); imagepng($new_img ,$file); imagedestroy($new_img);
http://www.manongjc.com/php/php_tutorial.html
http://www.manongjc.com/html/html_tutorial.html