Open totoro0103 opened 6 years ago
If you are using WKWebview, custom schemes like cdvphotolibrary:// are not [yet] supported. I had a similar problem and had to revert back to UIWebView --- that's the only way I could get this plugin to work.
See https://github.com/terikon/cordova-plugin-photo-library/issues/41 for more info.
thank a lot @jaybloke . I had solve my issue:
ionic cordova plugin rm cordova-plugin-ionic-webview --save
<preference name="webviewbounce" value="false" />
<preference name="UIWebViewBounce" value="false" />
<preference name="DisallowOverscroll" value="true" />
And it's work !
Following your steps @hoangphan92 above, it looks like you have not re-installed WKWebview - you have simply uninstalled WKWebview, so the default web view plugin will be used - UIWebView.
To see if WKWebview is installed correctly, try adding this to your main app component:
if (window.indexedDB) {
console.log('I have WKWebview installed!');
} else {
console.log('I have UIWebView installed!');
}
I'm so sorry @jaybloke . I mean: remove WKWebview. OMG ! ,my english is very bad
This works like a charm:-
If you are using wkwebview(which is now default for new apps) then follow below steps,
import { normalizeURL} from ‘ionic-angular’;
store your image path in some new variable.
var imagePath = this.file.dataDirectory + “test.png”;
this.tempImagePath = normalizeURL(imagePath);
then in your html file,
use tempImagePath as image src.
Source: https://forum.ionicframework.com/t/downloaded-image-is-not-displayed-ionic-3-8/110912/2
With WKWebview, this plugin is still not working. The workaround by @abcdurga only works with files ("file://") but the actual url (photoURL or thumbnailURL) I have to use is starting with "cdvphotolibrary://" which I cannot show with . I hope this will be fixed soon or to find any workaround.
Thanks for your great plugin.
@soulmecca were you able to find a way around this issue? i am facing the same thing as well even in my android phone. my photoURL starts with 'cdvphotolibrary://' and i cannot show my images as well
Unfortunately not @boyfunky - this was, and still is the deal-breaker for upgrading to WKWebview --- i'm still using UIWebView 👎
It's not really a fix but a kind of work around. I was saving the images directories to a SQLiteDB so with the WKWebview change I could no longer display my images so what I instead did is save the image ID provided in the saveImage() return object in photo-library, then when I need to use that image I use the getPhoto() call and pass the saved ID and then returns blob data, I then convert that blob data to base64 and use that for my image source.
I'm aware it's not suitable for everyone's needs but I thought of posting here in case it could help someone.
Is there an update on this yet?
Reverting back to UIWebView is the last option for me really. This is such an old issue, someone must have solved it right?
I have a issues that i can not understand. It's here: https://forum.ionicframework.com/t/ios-device-can-not-display-image-when-using-photo-library/114197 Please help me !