如何使用PHP获取网页的快照或缩略图? [英] How might I obtain a Snapshot or Thumbnail of a web page using PHP?
问题描述
我需要创建快照/缩略图/网站预览a-site.com.
I need to create Snapshots / Thumbshots / Site preview a-site.com.
有些网站如thumbshot.org可以满足我的需求.但是我不想使用外部服务,也不希望我的项目依赖其他人(如果他们关闭站点会发生什么?)
There are some site as thumbshot.org that meets with I need. But I do not want to use an external service, not to depend on others for my project (What would happen if they close the site?)
基于这个原因,我正在寻找一些项目来让我做到这一点.
For this reason, I am looking for some project to let me do this.
有什么主意吗?
推荐答案
PHP库中没有任何可做的事情-尽管您正在设置一个外部应用程序(带有队列)以拍摄图像,尽管您当然可以使用PHP将项目添加到队列中.
There isn't anything in the PHP library to do this - you're looking at setting up an external application (with a queue) to take images, although you can of course use PHP to add items to the queue.
GD中有几个Windows功能可以捕获计算机(网络服务器-而不是客户端)的屏幕快照,因此也许您可以使用PHP编写脚本来执行此操作.
There are a couple of Windows functions in GD that takes screen shots of the computer (webserver - not the client) so perhaps you could write a script in PHP to do this.
正在考虑以下内容: imagegrabscreen
和 imagegrabwindow
.我不确定他们会做什么,但是(即使在全屏模式下,Firefox在屏幕顶部也显示蓝色栏-不确定其他浏览器).但是, Pierre在这些功能上有一些如果您有兴趣.
Was thinking of these: imagegrabscreen
and imagegrabwindow
. I'm not sure they will do what you want however (even in full screen mode Firefox has ablue bar at the top of the screen - not sure about other browsers). However, Pierre has something on these functions if you're interested.
我建议您使用另一种语言(假设.NET具备某些功能)编写一个应用程序来为您完成此操作. 此页面告诉您如何在C#中执行此操作
I'd suggest writing an application in another language (I assume .NET has something) to do this for you. This page tells you how to do it in C#
这篇关于如何使用PHP获取网页的快照或缩略图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!