PHP截取IE浏览器并缩小原图的方法

yipeiwu_com5年前PHP代码库

本文实例讲述了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);

如果有问题可以选择桌面与程序交互

更多关于PHP相关内容感兴趣的读者可查看本站专题:《php日期与时间用法总结》、《php面向对象程序设计入门教程》、《php字符串(string)用法总结》、《php+mysql数据库操作入门教程》及《php常见数据库操作技巧汇总

希望本文所述对大家PHP程序设计有所帮助。

相关文章

php将日期格式转换成xx天前的格式

本文实例讲述了php将日期格式转换成xx天前格式的方法。分享给大家供大家参考。具体如下: 这段代码可以把时间格式化成3天前,5秒前,2年前的形式 // convert a date...

PHPstorm快捷键(分享)

如下所示: Eclipse快捷键 Ctrl+1 快速修复 Ctrl+D: 删除当前行 Ctrl+Alt+↓ 复制当前行到下一行(复制增加) Ctrl+Alt+↑ 复制当前行到上一行(...

同一空间绑定多个域名而实现访问不同页面的PHP代码

<?php  switch ($_SERVER["HTTP_HOST"]) {      case&...

PHP json_encode中文乱码问题的解决办法

下面的PHP代码可以解决以下问题:1.json_encode UTF8码中文后的字符串不可阅读2.json_encode 多级数组中文乱码问题3.json_encode 数组中包含换行时...

使用PHP接收POST数据,解析json数据

复制代码 代码如下:<?php $json_string = $_POST["txt_json"]; if(ini_get("magic_quotes_gpc"...