wymsee / cordova-imagePicker

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

Getting ENCODING_ERR in ios #257

Open suraj092kumar opened 6 years ago

suraj092kumar commented 6 years ago

on selecting image in ios getting FileError code: 5 message: "ENCODING_ERR"

yoojene commented 6 years ago

I got this too, looks like for iOS only the device-absolute-file-location is being returned

Worked around by appending a file URI

this.imagePicker.getPictures(options).then(
      res => {
        for (let i = 0; i < res.length; i++) {
          console.log('Image URI: ' + res[i]);
          let fullPath;
          if (this.plt.is('ios')) {
            fullPath = 'file://' + res[i];
          } else {
            fullPath = res[i];
          }
Nightbr commented 6 years ago

Hey, it seems we have the same issue, do you have any robust solution for this? Because it will bug in older version of iOS which already have file://...

Any idea?

Nightbr commented 6 years ago

@yoojene I tried this

       if(ionic.Platform.isIOS()){
            if(uri.indexOf('file://') == -1){
                uri = 'file://'+uri;
            }
        }

But I still have a blank image on iOS 11 when I tried to pass the uri to $jrCrop :/

I will dig deeper on this because the same code works great on Android...

https://github.com/JrSchild/jr-crop