如题所述
<?php
set_time_limit(60);
//æªå±
$im = imagegrabscreen();
imagepng($im, "snap1.png");
//æåIEçªå£
$browser = new COM("InternetExplorer.Application");
$handle = $browser->HWND;
$browser->Visible = true;
$im = imagegrabwindow($handle);
$browser->Quit();
imagepng($im, "snap2.png");
$im = imagegrabscreen();
//æåIEçªå£åçªå£å 容(IE为ä¾)
$browser = new COM("InternetExplorer.Application");
$handle = $browser->HWND;
$browser->Visible = true;
$browser->Navigate("http://www.baidu.com");
while ($browser->Busy) {
com_message_pump(4000);
}
$im = imagegrabwindow($handle, 0);
$browser->Quit();
imagepng($im, "snap3.png");
// IEå ¨å±æ¨¡å¼
$browser = new COM("InternetExplorer.Application");
$handle = $browser->HWND;
$browser->Visible = true;
$browser->FullScreen = true;
$browser->Navigate("http://www.baidu.com");
while ($browser->Busy) {
com_message_pump(4000);
}
$im = imagegrabwindow($handle, 0);
$browser->Quit();
imagepng($im, "snap4.png");
//çæç½ç«ç¼©ç¥å¾
$browser = new COM("InternetExplorer.Application");
$handle = $browser->HWND;
$browser->Visible = true;
$browser->Fullscreen = true;
$browser->Navigate("http://www.baidu.com");
while ($browser->Busy) {
com_message_pump(4000); //çå¾ 4ç§
}
$im = imagegrabwindow($handle, 0); //æåç½é¡µå¾åï¼éè¦php5.2.2以ä¸çæ¬çæ¯æ
$browser->Quit();
$new_img = imagecreatetruecolor(200,150);
imagecopyresampled($new_img,$im,0,0,0,0,200,150,1024,768);
imagejpeg($new_img , 'snap5.jpg',100);
imagedestroy($new_img);
echo "Done!";
?>
set_time_limit(60);
//æªå±
$im = imagegrabscreen();
imagepng($im, "snap1.png");
//æåIEçªå£
$browser = new COM("InternetExplorer.Application");
$handle = $browser->HWND;
$browser->Visible = true;
$im = imagegrabwindow($handle);
$browser->Quit();
imagepng($im, "snap2.png");
$im = imagegrabscreen();
//æåIEçªå£åçªå£å 容(IE为ä¾)
$browser = new COM("InternetExplorer.Application");
$handle = $browser->HWND;
$browser->Visible = true;
$browser->Navigate("http://www.baidu.com");
while ($browser->Busy) {
com_message_pump(4000);
}
$im = imagegrabwindow($handle, 0);
$browser->Quit();
imagepng($im, "snap3.png");
// IEå ¨å±æ¨¡å¼
$browser = new COM("InternetExplorer.Application");
$handle = $browser->HWND;
$browser->Visible = true;
$browser->FullScreen = true;
$browser->Navigate("http://www.baidu.com");
while ($browser->Busy) {
com_message_pump(4000);
}
$im = imagegrabwindow($handle, 0);
$browser->Quit();
imagepng($im, "snap4.png");
//çæç½ç«ç¼©ç¥å¾
$browser = new COM("InternetExplorer.Application");
$handle = $browser->HWND;
$browser->Visible = true;
$browser->Fullscreen = true;
$browser->Navigate("http://www.baidu.com");
while ($browser->Busy) {
com_message_pump(4000); //çå¾ 4ç§
}
$im = imagegrabwindow($handle, 0); //æåç½é¡µå¾åï¼éè¦php5.2.2以ä¸çæ¬çæ¯æ
$browser->Quit();
$new_img = imagecreatetruecolor(200,150);
imagecopyresampled($new_img,$im,0,0,0,0,200,150,1024,768);
imagejpeg($new_img , 'snap5.jpg',100);
imagedestroy($new_img);
echo "Done!";
?>
温馨提示:答案为网友推荐,仅供参考
第1个回答 2016-12-27
php好像不能实现,你可以通过H5的canvs画布来转换成图像