wymsee / cordova-imagePicker

Cordova Plugin For Multiple Image Selection
MIT License
407 stars 858 forks source link

Return image source (file:///data/data/.../) but not show image instead of just show blank #69

Open vanthienpc opened 9 years ago

vanthienpc commented 9 years ago

I just test on Android 4.4.

When I choose a picture from gallery. It's return image source but I can't display image on view as expect. It show blank space instead of show image

file path return: file:///data/data..../name.jpg

Anyone help me find out the way to show it. I'll really appreciate

Thanks

clarklight commented 8 years ago

I am facing the same issue

vanthienpc commented 8 years ago

Are you running the application in live reload mode, right ? If true then you should add this line below config part of app.js $compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|content|file|assets-library):|data:image\//);

And after that, run app at normal mode. It'll work well

clarklight commented 8 years ago

I spent some time looking at it further, and realized i only have the file URI problem when the photos are from SD card. If the photo is saved into the phone, then it has no problem. So there is no problem on IOS, but on Android.

pavanputhra commented 8 years ago

+1

EbuOgden commented 8 years ago

Hi @vanthienpc, @clarklight @pavanputhra u should use window.resolveLocalFileSystemURI() to show images. Here how i handle it This is select function :

window.imagePicker.getPictures(gallerySuccess, galleryError, { maximumImagesCount : 1, width : 462, height : 462 /* BTW : this options (width, height) not working */ });

When selected photos returned to success function :
Gallery Success :

function(results){ window.resolveLocalFileSystemURI(results[0], onResolveSuccess, onResolveFail);
}

Resolve Success :
function(fileEntry){ fileEntry.file(function(file){ U will use file.LocalURL for show image } }

I am using file method for insert file objects to database. If u don't need inserting, just use fileEntry.fullPath. Good Luck.

jintangWang commented 8 years ago

I have the same problem.Do you have a solution?