Skip to content

Instantly share code, notes, and snippets.

@TheSeamau5
Last active August 29, 2015 14:25
Show Gist options
  • Save TheSeamau5/90cf61f38fb526119a6c to your computer and use it in GitHub Desktop.
Save TheSeamau5/90cf61f38fb526119a6c to your computer and use it in GitHub Desktop.
Image Capture example
<form>
<input id = "myInput" type="file" accept="image/*" capture="camera">
<img id ="myImage" src = "#"/>
</form>
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