与imagegrabscreen和WAMP捕获图像 [英] Capture image with imagegrabscreen and Wamp

查看:197
本文介绍了与imagegrabscreen和WAMP捕获图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图捕捉imagegrabscreen本地网页,但我只得到一个黑色的屏幕截图。我想几乎所有的解决方案的问题,从这里SO和其他网站无法工作。

I'm trying to capture a local web page with imagegrabscreen but I only get a black screenshot. I tried almost every solution from questions here on SO and others sites and nothing works.

我使用并完成以下内容:

I'm using and done the following:


  • Windows 7的64位

  • 2.2A WAMP 64

  • PHP 5.3.8

  • GD2(版本:2.0.34捆绑兼容)已安装并启用

  • 允许Apache服务与桌面交互。

  • 我没有辅助显示器或任何东西。

<?php    
   $im = imagegrabscreen();    
   imagepng($im, "myscreenshot.png");    
   imagedestroy($im);    
?>

和我得到的是一个黑色图像1024×768 PNG。

And all I get is a black image 1024x768 png.

推荐答案

您可以做到这一点。我这样做。我没有使用WAMP。我用一切分开。我把所有的PHP,MySQL和Apache的安装。

You can do it. I did this. I didn't use WAMP. I used everything separate. I have all PHP, MySQL and Apache setup.

下面是步骤。


  1. 停止Apache服务器的服务。您可以通过调用做到这一点。

  1. Stop the Apache server service. You can do this by invoking

NET STOP Apache2.2

也可以打开 SERVICES.MSC 然后停止它。

的Apache2.2 文件夹复制出的C:\\ 把它放在什么地方,你可以完全访问即可。像文件或其它驱动器。我把它放在 K 。为确保您有充分的机会,

Copy the Apache2.2 folder out of C:\. Put it somewhere where you have full access. Like Documents or in other drive. I put it in K:. To be sure you have full access,


  1. 递归加深对Apache目录的所有权。

  2. 确保您有完全控制标记勾选的Apache2.2 文件夹的安全选项卡上。

  3. 这个新的Apache的配置文件的httpd.conf 将包含大量的硬codeD路径。像 C:\\ Apache Software Foundation的\\的Apache2.2 。只需更换那些与你的新路径。在我的情况是 K:\\的Apache2.2

  1. Recursively get ownership of the Apache directory.
  2. Make sure You have Full control marked tick on security tab of the Apache2.2 folder.
  3. This new Apache's configuration file httpd.conf will contain a lot of hardcoded paths. Like C:\apache software foundation\apache2.2. Just replace those with your new path. In my case it was K:\Apache2.2.

在这一刻你的Apache服务器服务应当停止。所以80端口不会被阻止。而且你必须的您自己的的Apache网站的您自己的的领土(目录)。

  • At this moment your Apache Server Service should be stopped. So 80 port will not be blocked. And you'll have your own Apache at your own territory (directory).

    打开控制台窗口并转到的htdocs 文件夹使用 CD

    Open a console window and go to your Apache home where htdocs folder resides along with some other folders using cd

    打开网页。随着下面code。

    Open your web page. With following code.

    <?php
    header("Content-type: image/png");
    $im = imagegrabscreen();    
    imagepng($im);
    imagedestroy($im); 
    exit(0);
    ?>
    


  • 您会看到图像。

  • You'll see the image.

    这篇关于与imagegrabscreen和WAMP捕获图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆