HTML5 paste image to page
Did you know that
HTML5
lets the user paste an image into the DOM tree? See a demo here and find the code needed in this
Gist
. I first came across this code here in a post
HTML5 JavaScript Pasting Image Data in Chrome
by
Daniel X Moore
(from 2011!).
Instructions
: Copy an image to clipboard (For instance:
Mac
:
cmd+shift+ctrl+4
and
Win
:
Alt+PtrScr
), click on the
target div
to paste the image into, and paste
cmd+V
or
ctrl+v
.
Version 1.1
Added camera snapshoot sound on paste - use my pen
Snapshoot sound - snapshoot()
to get that feature on your pens. Also added option to toggle
background-size: contain
when clicking on pasted image.