Unable to load image when selected from the gallery on Android 4.4 (KitKat) using PhoneGap Camera Plugin

后端 未结 6 426
小蘑菇
小蘑菇 2020-12-01 06:15

I\'m trying to set the source of an img tag in my app based on the image chosen from the device image gallery using the PhoneGap/Cordova Camera Plugin.

It has worked

6条回答
  •  渐次进展
    2020-12-01 07:03

    Here is a simple fix to this problem:

    replace this:

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

    by this:

    content://com.android.providers.media.documents/document/image%253A352
    

    if you are using JavaScript you can use this code:

    var path = content://com.android.providers.media.documents/document/image%3A352;
    path = path.replace("%", "%25");
    

    this technique force the uri to let pass "%3A" as it is, without changing it to ":", hope it will work for you !

提交回复
热议问题