服务器生成的网页截图? [英] Server Generated web screenshots?

查看:39
本文介绍了服务器生成的网页截图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在玩弄的一个问题是一项服务,它要求我的服务器在给定的 url 上生成网页的屏幕截图.问题是我不知道如何实现这一点.我主要使用 LAMP 软件堆栈,因此考虑到这一点给出的答案将是最有帮助的.同样,基本要求是: 给定一个 url,服务器需要在该 url 处生成渲染网页的图像文件.提前致谢!

One problem I've been toying with off and on is a service that requires my server to produce a screenshot of a webpage at a given url. The problem is that I don't have any idea how I would accomplish this. I mostly use a LAMP software stack, so answers that were given with that in mind would be the most helpful. Again the basic requirements are: Given a url, the server needs to produce an image file of the rendered web page at that url. Thanks in advance!

推荐答案

如果你的服务器是Mac,那我推荐webkit2png,这是一个利用 WebKit 的 Objective-C API 呈现 URL 的简短 Python 程序.就我个人而言,我将它与 WWW::Mechanize 结合使用来走我的开发站点并制作每个页面的屏幕截图——对于测试功能、向客户展示和保持屏幕截图是最新的很有用.生成的屏幕截图是完美的,但有时对于长滚动页面来说非常高.

IF your server is a Mac, then I recommend webkit2png, which is a short python program that leverages WebKit's Objective-C API to render an URL. Personally, I use it in combination with WWW::Mechanize to walk my development site and make screenshots of every page -- useful for testing functionality, showing clients and keeping screenshots up-to-date. The resulting screenshot is perfect, but sometimes very tall for long, scrolling pages.

如果您的服务器有安装了 KDE 的非裸机 Linux 发行版,那么您可以尝试 khtml2png.我自己没有尝试过,但在 webkit2png 页面上看到它提到.

IF your server has a non-bare-bones Linux distro with KDE installed, then you might try khtml2png. I have not tried that myself, but saw it mentioned on the webkit2png page.

这篇关于服务器生成的网页截图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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