Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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