matthisb
matthisb

Reputation: 1118

Phonegap: Camera.getPicture only returns NATIVE_URI

I'm trying to get an image via phonegap from SAVEDPHOTOSALBUM and present it on the screen. Like phonegap docs say, I use getPicture like this:

navigator.camera.getPicture(onSuccess, onFail, { quality: 50,
    destinationType: Camera.DestinationType.DATA_URL,
    sourceType: Camera.PictureSourceType.SAVEDPHOTOALBUM,
    encodingType: Camera.EncodingType.JPEG
 });

On iOS-Devices it works just fine. I'm getting the imageData as Base64 and can easily print it out via img-Tag. On Android-Devices (Nexus7, Nexus10 both KitKat) it only returns the native_uri. Something like that:

content://com.android.providers.media.documents/document/image%3A9539

So my question is, how can I retrieve the image from SAVEDPHOTOSABUM as Base64 and not as URI ? Why does Phonegap not return it correctly ?

Upvotes: 1

Views: 1016

Answers (1)

Hazem Hagrass
Hazem Hagrass

Reputation: 9808

this plugin is used to calculate base64 encoding of a file located on file system:

window.plugins.Base64.encodeFile(filePath, function(base64){
        console.log('file base64 encoding: ' + base64);
    });

Upvotes: 2

Related Questions