Telerik-Verified-Plugins / WKWebView

DEPRECATED - this plugin served a purpose in the past, but there are better implementation now
832 stars 149 forks source link

Cannot load local image files #183

Open lightwithoutheat opened 8 years ago

lightwithoutheat commented 8 years ago

I have an app that displays images stored on the local device file system, e.g.

function loadLocalFile(name) { return cordova.file.dataDirectory + name; }

This has all been working perfectly, until I installed the WkWebView plugin and now my images are no longer loading. Is there anything obvious that I've missed or that needs to be added after installing this plugin or is this a bug?

mrsubtle commented 8 years ago

Possibly related, but my project with a LaunchScreen.xib that includes an Image control pointing to a local image file is now broken as well.

leobetosouza commented 8 years ago

Same here. cordova.file.applicationStorageDirectory fails since installation of WKWebView

dylanspurgin commented 8 years ago

Just to hopefully allow people to work around this issue, we were able to use cordova-file-plugin to read files once we started using WKWebView. We had to use applicationStorageDirectory for iOS and externalApplicationStorageDirectory for Android (we are reading images taken from the camera). We read the file as base64 encoded data and were able to pass that string back to ng-src (AngularJs image src attribute) to display the image.

mrsubtle commented 8 years ago

Thanks for the workaround suggestion. Much appreciated.

Richard Bennett rich@n2d.co | http://n2d.co/ | @mr_subtle | Behance | Dunked | Scoutzie

On Oct 27, 2015, at 2:09 PM, dylanspurgin notifications@github.com wrote:

Just to hopefully allow people to work around this issue, we were able to use cordova-file-plugin to read files once we started using WKWebView. We had to use applicationStorageDirectory for iOS and externalApplicationStorageDirectory for Android (we are reading images taken from the camera). We read the file as base64 encoded data and were able to pass that string back to ng-src (AngularJs image src attribute) to display the image.

— Reply to this email directly or view it on GitHub.

castrojr913 commented 8 years ago

@dylanspurgin Yeah! the trick is using the image with Base 64 format. I had a similar issue with Camera plugin which my iOS application crashed trying to read an local image and this approach fixed the trouble.