Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var pictureSource; // picture source
- var destinationType; // sets the format of returned value
- document.addEventListener("deviceready",onDeviceReady,false);
- function onDeviceReady() {
- pictureSource=navigator.camera.PictureSourceType;
- destinationType=navigator.camera.DestinationType;
- }
- function onPhotoDataSuccess(imageData) {
- // navigator.notification.alert("win");
- var smallImage = document.getElementById('smallImage');
- // smallImage.style.display = 'block';
- smallImage.src = "data:image/jpeg;base64," + imageData;
- draw(smallImage);
- }
- function capturePhoto() {
- if (navigator.camera) {
- navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 25, destinationType: destinationType.DATA_URL });
- } else {
- console.log("phonegap camera not available");
- }
- }
- function onFail(message) {
- //navigator.notification.alert("fail");
- alert('Failed because: ' + message);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement