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

yipeiwu_com6年前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 include的妙用,实现路径加密

1、中转程序include.inc 复制代码 代码如下: <? include_once 'include/Base.php'; $path = ''; $url = isBase...

在PHP中输出JS语句以及乱码问题的解决方案

怎样在php中输出js语句? 示例 <?php $classState=""; if($state==0){ $classState="已下课"; } else{ $c...

php 生成随机验证码图片代码

复制代码 代码如下:<?php /** 默认首页 **/ class DefaultController extends AppController { public functi...

php接口技术实例详解

本文实例讲述了php接口技术。分享给大家供大家参考,具体如下: 1.接口是一种特殊的抽象类,为什么这么说呢?如果一个抽象类中所有的方法都是抽象方法,那么我们就换一种称呼,称为“接口”。...

PHP简单实现二维数组的矩阵转置操作示例

PHP简单实现二维数组的矩阵转置操作示例

本文实例讲述了PHP简单实现二维数组的矩阵转置操作。分享给大家供大家参考,具体如下: <?php $arr1 = array( array(1,2,...