PHP imagegrabscreen和imagegrabwindow(截取网站缩略图)的实例代码_php实例
$im = imagegrabscreen();
imagepng($im, “myscreenshot.png”);
?>
2. 截取一个窗口 Capture a window (IE for example)
$browser = new COM(“InternetExplorer.Application”);
$handle = $browser->HWND;
$browser->Visible = true;
$im = imagegrabwindow($handle);
$browser->Quit();
imagepng($im, “iesnap.png”);
$im = imagegrabscreen();
?>
3. 截取IE内容 Capture a window (IE for example) but with its content!
$browser = new COM(“InternetExplorer.Application”);
$handle = $browser->HWND;
$browser->Visible = true;
$browser->Navigate(“http://www.jb51.net”);
/* Still working? */
while ($browser->Busy) {
com_message_pump(4000);
}
$im = imagegrabwindow($handle, 0);
$browser->Quit();
imagepng($im, “iesnap.png”);
?>
4. 截取IE的全屏模式 IE in fullscreen mode
$browser = new COM(“InternetExplorer.Application”);
$handle = $browser->HWND;
$browser->Visible = true;
$browser->FullScreen = true;
$browser->Navigate(“http://www.jb51.net”);
/* Is it completely loaded? (be aware of frames!)*/
while ($browser->Busy) {
com_message_pump(4000);
}
$im = imagegrabwindow($handle, 0);
$browser->Quit();
imagepng($im, “iesnap.png”);
?>
上面就是说如何使用PHP COM调用IE窗口打开网页进行截屏,但很多朋友得到的结果只是一张纯黑的图片,这是为什么呢?
可能有两种情况,第一种情况就是这个COM组件只适用于WINDOWS服务器,其它系统的服务器是不支持的,因为他没有IE浏览器,第二种情况就是没有打开允许服务与桌面交互!其中第二种情况最为常见,打开的方法就是点击计算机(我的电脑) -> 右键 -> 管理 -> 服务和应用程序 -> 服务 -> Apache(我自己使用apache服务器) -> 右键 -> 属性 -> 登录 -> 登录身份下面既是!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

Working with database in CakePHP is very easy. We will understand the CRUD (Create, Read, Update, Delete) operations in this chapter.

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

To work on file upload we are going to use the form helper. Here, is an example for file upload.

In this chapter, we are going to learn the following topics related to routing ?

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

Validator can be created by adding the following two lines in the controller.

Logging in CakePHP is a very easy task. You just have to use one function. You can log errors, exceptions, user activities, action taken by users, for any background process like cronjob. Logging data in CakePHP is easy. The log() function is provide
