Skip to content

Instantly share code, notes, and snippets.

@whisher
Created October 8, 2014 15:44
Show Gist options
  • Select an option

  • Save whisher/114c07a6fc0bf38ced08 to your computer and use it in GitHub Desktop.

Select an option

Save whisher/114c07a6fc0bf38ced08 to your computer and use it in GitHub Desktop.
function takePhoto() {
navigator.camera.getPicture(cameraSuccess, cameraError, {
quality : 50,
destinationType: Camera.DestinationType.DATA_URL
});
}
function cameraSuccess(imageData) {
//Get a handle to the image container div
ic = document.getElementById('imageContainer');
//Then write an image tag out to the div using the
//URL we received from the camera application.
ic.innerHTML = '<img src="' + "data:image/jpeg;base64," + imageData + '" width="50%" />';
myFirebaseRef.set({
data:imageData
});
alert('Done');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment