Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to capture HTML page as an image using Javascript / Jquery / HTML5 function [closed]

I would like to have a button on my website which can capture current image of my webpage. I have seen Google's "send feedback" function and want to implement tat in my web page. I also read about html2canvas and found below problems while implementing.

  1. Html2canvas won't save any swf object of the page.
  2. implementation of html2canvas is not document enough to understand how to use tat.
  3. customization on html2canvas is not easy (might be only for me its not easy).
  4. i want to save capture image after highlight / black out in my local drive or my web server

guys i don't bother about security issue or other things since i want to use this feature for prototype only in fact if its work in local then also its fine.

I can use local host to run this page in browser and can capture the image and save in local.

I'm also open for other solution apart from html2canvas. I just want to capture a webpage as an image if i can get highlighting and black out then it will be icing on a cake :).

Thank you :)

like image 322
Ankit Avatar asked Jun 06 '26 16:06

Ankit


2 Answers

try http://html2canvas.hertzen.com/ it will be useful for you i think .

like image 163
Mansoor Jafar Avatar answered Jun 09 '26 06:06

Mansoor Jafar


I just had a test with http://www.bitpixels.com/register Registration is done via google account and the service is free up to several thousands of thumbnails per month.

Just use curl:

curl --get "http://img.bitpixels.com/getthumbnail?code=SOME-CODE-YOU-GET-BY-REGISTRATION&url=http://www.example.com"

Your favorite programming-language should have support for that.

Consider this php-example:

<?php
$ch = curl_init('http://img.bitpixels.com/getthumbnail?code=SOME-CODE-YOU-GET-BY-REGISTRATION&url=http://www.example.com');
curl_setopt_array($ch, array(
    CURLOPT_BINARYTRANSFER  => true,
    CURLOPT_RETURNTRANSFER  => true
));
$imageBinary = curl_exec($ch);
file_put_contents('test.png', $imageBinary);

Please refer for further information regarding php-curl to: http://php.net/manual/de/book.curl.php

and for image-handling with php to: http://php.net/manual/en/ref.image.php

like image 40
Jojo Avatar answered Jun 09 '26 04:06

Jojo