Last active
August 29, 2015 14:25
-
-
Save TheSeamau5/90cf61f38fb526119a6c to your computer and use it in GitHub Desktop.
Image Capture example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form> | |
<input id = "myInput" type="file" accept="image/*" capture="camera"> | |
<img id ="myImage" src = "#"/> | |
</form> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var input = document.getElementById("myInput"); | |
var image = document.getElementById("myImage"); | |
input.onchange = function(){ | |
if (input.files && input.files[0]){ | |
var reader = new FileReader(); | |
reader.onload = function(event){ | |
image.src = event.target.result; | |
} | |
reader.readAsDataURL(input.files[0]); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment