Cordova PictureSourceType PHOTOLIBRARY v SAVEDPHOTOALBUM

None of these values ​​work for launching the photo gallery in the phonegap app for Android.

When a method getPictureis called with any of these values, it does not pull out the photo gallery.

I am building an application using cloudgroup build services

Please, help,

sample code -

function getPhoto(source) {
  alert("getting photo");
  // Retrieve image file location from specified source
  navigator.camera.getPicture(onPhotoURISuccess, onFail, { destinationType: destinationType.FILE_URI, sourceType: source });
}
+4
source share
2 answers

Camera.PictureSourceType.PHOTOLIBRARY == entire library

Camera.PictureSourceType.SAVEDPHOTOALBUM == camera photo album

If you want users to download any image to their phone, click PHOTOLIBRARY. Or, if you want users to upload only pictures taken with the phone’s camera, use SAVEDPHOTOALBUM.

+8
source

, .

function getImage()
{
    // Retrieve image file location from specified source
    navigator.camera.getPicture(onCapturePhotoSuccess, onCapturePhotoError,{ quality: 80, 
        destinationType: navigator.camera.DestinationType.DATA_URL,
        sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY
    });
}

function onCapturePhotoSuccess(imageURI) 
{   
    var smallImage = document.getElementById('id_for_setting_pic_somewhere_in_html');
        smallImage.src = "data:image/jpeg;base64," + imageURI;
}


function onCapturePhotoError(message) 
{
    console.log('Captured Failed because: ' + message); 
}
0

All Articles