samedi 25 avril 2015

Cordova Plugin: Unable to retrieve path to picture


Searching for a solution to the following problem for a while and can't seem to find any solutions. Any help is welcome.

The camera plugin of cordova returns the following error when trying to access a picture using the camera.

Unable to retrieve path to picture!

I tried FILE_URI and DATA_URL.

I use cordova version 5.0.0 and cordova-plugin-camera.

The following path fails e.g.

/storage/emulated/0/Download/horse-331746_640.jpg 

The following path functions e.g.

/storage/emulated/0/WhatsApp/Media/WhatsApp Images/IMG-2015019-WA0000.JPG 

My Function:

function captureNow(bGallery){

    if(bGallery === true){
        navigator.camera.getPicture(onCapturePhoto, cameraOnFail, {
            quality: 100,
            correctOrientation: 1,
            targetWidth: 500,
            targetHeight: 500,
            encodingType: Camera.EncodingType.JPEG,
            destinationType: Camera.DestinationType.FILE_URI,
            sourceType: Camera.PictureSourceType.PHOTOLIBRARY
        });
    } else {
        navigator.camera.getPicture(onCapturePhoto, cameraOnFail, {
            quality: 100,
            correctOrientation: 1,
            targetWidth: 500,
            targetHeight: 500,
            encodingType: Camera.EncodingType.JPEG,
            destinationType: Camera.DestinationType.FILE_URI
        });
    }
}


Aucun commentaire:

Enregistrer un commentaire