使用jquery生成网站的屏幕截图 [英] generating a screenshot of a website using jquery

查看:521
本文介绍了使用jquery生成网站的屏幕截图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用严格的javascript生成任何给定URL的屏幕快照缩略图.如果无法做到这一点,那么谁能用我自己的api指向我正确的方向呢?

I would like to generate a screenshot thumbnail of any given url using strictly javascript. If this can't be done can anyone point me in the right direction to do this with my own api?

edit我只是决定作弊并使用框架,因为无论如何我都是为了娱乐而做,但是感谢所有出色的回答,如果您想做这样的事情,khtmltox可能是最佳选择……他们还有php绑定.

edit I just decided to cheat and use frames because it was for something I was doing for fun anyway, but thanks for all the great answers khtmltox is probably the best choice if you want to do something like this... they also have php bindings aswell.

推荐答案

如果您查看 wkhtmltox ,用于将网页转换为图像的lib/app.

If you look at wkhtmltox, there's native lib/app for converting a webpage to an image.

<?php // file: img.php
    $img=render_image($_GET['url']);
?>


<!-- Your Website -->

<img alt='ldr'/>

<script type="text/javascript">
    $(document).ready(function(){
        var url='http://google.com/';
        $('#img').attr('src','img.php?url='+encodeURIComponent(url));
    });
</script>

如果注释不够清晰,则需要在可以运行本机程序的地方安装PHP.

In case the comment wasn't clear enough, you need PHP somewhere which could run a native program.

这篇关于使用jquery生成网站的屏幕截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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