walters
  • walters
Hi help please php,javascript and html Is there any way of taking screen shot of any part of the interface but not the whole window and save it as an image in a file.
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
schrodinger
  • schrodinger
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
CyberShadow
  • CyberShadow
If you are talking about taking the screenshot of a part of a webpage , then yes it is possible.....but if you are talking abt taking the screenshot of user's desktop/wholescreen ,using php and html then No. Screenshot of a webpage could be taken in multiple ways , but the most suitable way in my opinion would be to use , \(\href{http:///html2canvas.hertzen.com/documentation.html}{html2canvas}\) library . Example: Suppose we want to take screenshot of div with id "test" Html Code:-
Take My screenshot

Some other part of html

Javascript Code: var element = document.getElementById('test'); html2canvas(element, { onrendered: function(canvas) { //rendered canvas var download = document.createElement('a')//creating link for downloading image download.href =canvas.toDataURL();//use canvas.toDataURL('image/jpeg') for jpg file download.download = true; document.appendChild(download); } });
walters
  • walters
so its that all can i test it now to see the output? or i still have to do extra things
CyberShadow
  • CyberShadow
That is all, You just have to include html2canvas.js in ur external javascript libraries

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

walters
  • walters
maybe thats why
walters
  • walters
error on property"canvas let me redo it"
CyberShadow
  • CyberShadow
here is the working/complete version of the example.....http://pastebin.com/wKqtSmmL
walters
  • walters
screenshot
Take My screenshot

Some other part of html

walters
  • walters
this is the error i am getting check the attachment
1 Attachment
CyberShadow
  • CyberShadow
have you tried using this code ?....... http://pastebin.com/wKqtSmmL <----
CyberShadow
  • CyberShadow
That error is shown because html2canvas.js isnt downloaded on your system.... you can use cdn version tho....and code given in http://pastebin.com/wKqtSmmL should work fine.What are you getting using that code?
walters
  • walters
it actually outputs the exact code i 'va copied ,is the a way to embed the button which i will click it to take screen shot.but it is working tho.
CyberShadow
  • CyberShadow
So image is being downloaded when u click on button?or is it giving error?
walters
  • walters
i can say it the image but it output the code as an image so i don't know how am i going to put it on my code
walters
  • walters
THIS IS ACTUALLY THE OUTPUT I GET
Take My screenshot

Some other part of html

CyberShadow
  • CyberShadow
can you upload the image which is being downloaded?
walters
  • walters
let me look for it ..
walters
  • walters
no image being doawnloaded the output is just the code .
anonymous
  • anonymous
Hey. i have always wanted to use screen shots in my websites. i just tested and followed the code above, it out puts the code exactly as is.
walters
  • walters
ok i've put it on my local host this is what i get now
1 Attachment
CyberShadow
  • CyberShadow
Yes thats the screenshot of your div...... it is working , If you want to open the image instead of downloading it , just change "download.download = true;" to "download.download =false;" in your code.
anonymous
  • anonymous
its working now, thank you alot :)
walters
  • walters
ok it is fine thanks :)
CyberShadow
  • CyberShadow
no worries
anonymous
  • anonymous
Have you tried Snipping Tool?

Looking for something else?

Not the answer you are looking for? Search for more explanations.