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对数组内元素进行随机调换的方法

本文实例讲述了php对数组内元素进行随机调换的方法。分享给大家供大家参考。具体分析如下: 这是一个自定义的php数组元素随机调换的函数,php已经有一个内置的同样功能的函数shuffle...

PHP中计算字符串相似度的函数代码

similar_text — 计算两个字符串的相似度 int similar_text ( string $first , string $second [, float &$perc...

php self,$this,const,static,->的使用

今天来总结下。 、在类的内部方法访问已经声明为const及static的属性时,使用self::$name的形式。注意的是const属性的申明格式,const PI=3.14,而不是co...

php 广告调用类代码(支持Flash调用)

调用方式如下:其中DebugStr这个函数就是类似一个echo。 复制代码 代码如下: DebugStr('$Adv->getContentById($id); $id为广告编号,...

php 读取文件头判断文件类型的实现代码

php代码实现读取文件头判断文件类型,支持图片、rar、exe等后缀。案例:复制代码 代码如下:<?php $filename = "11.jpg";//为图片的路径可以用d:/u...