Skip to content

Instantly share code, notes, and snippets.

@cfjedimaster
Created April 24, 2014 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cfjedimaster/11255545 to your computer and use it in GitHub Desktop.
Save cfjedimaster/11255545 to your computer and use it in GitHub Desktop.
document.querySelector("#camera").addEventListener('touchend', function() {
navigator.camera.getPicture(onSuccess, onFail, { quality: 50,
destinationType: Camera.DestinationType.DATA_URL
});
function onSuccess(imageData) {
var image = document.getElementById('myImage');
image.src = "data:image/jpeg;base64," + imageData;
}
function onFail(message) {
alert('Failed because: ' + message);
}
}, false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment