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 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.
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>
In case the comment wasn't clear enough, you need PHP somewhere which could run a native program.
There is absolutely zero chance to do that with Javascript.
Actually, there isn't a chance at all to accomplish that with any "web"'ish technique. There might be a funky flash-app, I don't know (if that exists, one more reason to hate flash :p).
Not gonna happen. The ONLY way you MIGHT be able to do this with JS is if the site is hosted on YOUR server and you have JS trigger to some shell script that renders the users page on your local server and saves it as an image.
You want a subscription to browser shots
There is no way to do this in Javascript.
I believe this can be done via server-side using third-party software.
Have a look at this tutorial for more info.
Bit old, but I faced the same problem and found http://html2canvas.hertzen.com/
You can't do this just with JavaScript. You have to use a service like SnapCasa or similar (which basically comes down to an img
tag in the right format, so it's all client-side from your perspective).
In pure js it is not possible at moment.
I installed cutycap on my server which is responsible for generating the pictures
and with some js ajax magic you can easily create your own screen shoot - thumbnail service
Need to get screenshot website see checkout this is one
phpwdn.com
I recently created a REST API anyone can use to generate screenshots of websites. It is for free ( ofcourse ) and might can help you aswell.
Below are the links to some of my experiments.
Mashable ScreenShot
http://storage.damnovae.com/issac/ba3d01a1ddeeb068fd365eb8468c4cd35150d143.png
Pinterest
http://storage.damnovae.com/issac/f3419f73e840f2684fa15cb14154d507484b7318.png
Envato Screenshot with mobile portview
http://storage.damnovae.com/issac/81c875e6622ca105db4135b19cde6b83d148b21f.png
How does it work
Get your pastiche account api key , and make post request to the api url to generate screenshots. You can read more here http://damnovae.com/pastiche