FILE_URI path for Camera not working on IONIC 4
In previous versions of Ionic, this would be solved by using normalizeURL
. This will not work on Ionic 4 (or at least I could not make it work).
To solve this issue, you will need to use convertFileSrc()
:
import {WebView} from '@ionic-native/ionic-webview/ngx';
...
this.camera.getPicture(options).then((url) => {
// Load Image
this.imagePath = this.webview.convertFileSrc(url);
}, (err) => {
console.log(err);
});
Now the image URL will be in the appropriate http://localhost:8080/_file_/storage...
format and will load correctly.
See WKWebView - Ionic Docs for more information.