简体   繁体   中英

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 ?

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);
    });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM