zyra / ionic-image-loader

Ionic 2+ Component that loads images in a background thread and caches them for later use
MIT License
435 stars 137 forks source link

convertFileSrc method missing in some WebView #248

Open Enrico204 opened 5 years ago

Enrico204 commented 5 years ago

As mentioned here, convertFileSrc is missing in some WebView version (such as in Ionic 3 with WebView 1.2.1). The current workaround (until an upgrade is done) is to set this.imageLoaderConfig.setImageReturnType('base64'); so the image is serialized in Base64, but this is not very efficient.

I suggest to create a local version of convertFileSrc method (see here for implementation) to use if the original one is missing, or if the global WebView object is undefined (this is my case).

I can't create a PR right now (too busy), but I'll be happy to contribute if no one will work on that :-)