使用jquery生成网站的屏幕截图

Tyl*_*ler 14 php jquery screenshot thumbnails

我想使用严格的javascript生成任何给定网址的屏幕截图缩略图.如果不能做到这一点,任何人都可以指出我正确的方向用我自己的api做到这一点?

编辑我只是决定欺骗和使用框架,因为它是为了我的乐趣无论如何,但感谢所有伟大的答案khtmltox可能是最好的选择,如果你想做这样的事情...他们也有PHP绑定以及.

Chr*_*ian 12

如果你看一下wkhtmltox,就有用于将网页转换为图像的原生lib/app.

<?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>
Run Code Online (Sandbox Code Playgroud)

如果评论不够清楚,您需要PHP可以运行本机程序.