Home  >  Article  >  Backend Development  >  How to intercept IE browser and reduce the original image with PHP, intercept the original image of IE with PHP_PHP tutorial

How to intercept IE browser and reduce the original image with PHP, intercept the original image of IE with PHP_PHP tutorial

WBOY
WBOYOriginal
2016-07-12 08:57:58807browse

How to intercept IE browser and reduce the original image with PHP, intercept the original image of IE with php

This article describes the method of intercepting IE browser and reducing the original image with PHP. Share it with everyone for your reference, the details are as follows:

// 截取一个窗口 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);

If you have any questions, you can choose the desktop to interact with the program

Readers who are interested in more PHP-related content can check out the special topics of this site: "Summary of PHP Date and Time Usage", "Introduction Tutorial on PHP Object-Oriented Programming", "Summary of PHP String Usage", " PHP mysql database operation introductory tutorial" and "php common database operation skills summary"

I hope this article will be helpful to everyone in PHP programming.

Articles you may be interested in:

  • How to intercept specified image size in PHP
  • Example code of PHP imagegrabscreen and imagegrabwindow (intercepting website thumbnails)
  • php realizes pasting screenshots and completes the upload function
  • php obtains SWF animation screenshot sample code
  • THINKPHP JS implements zoom picture screenshots
  • PHP uses imagick to generate combined thumbnails
  • Sharing of code for scaling images and cutting images in PHP
  • How to generate thumbnails in original proportion in PHP

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1106119.htmlTechArticleHow to intercept IE browser with PHP and reduce the original image, php intercepts the original image of ie. This article tells the example of intercepting IE with PHP browser and reduce the size of the original image. Share it with everyone for your reference, the details are as follows:...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn