ionic2 PhotoViewer local file
https://ionicframework.com/docs/v2/native/photo-viewer/
follow step just do.
Now focus
https://github.com/sarriaroman/photoviewer/issues/11
ps: declare var cordova: any;
ps2: cordova plugin add cordova-plugin-file
www/assets/img is ionic2 now version, maybe future change, but now this is correct
showImage(imageUrl) {
if (this.platform.is(‘cordova’) && this.platform.is(‘android’)) {
File.readAsDataURL(cordova.file.applicationDirectory + “www/assets/img/”, imageUrl)
.then((dataURL:string) => {
PhotoViewer.show(dataURL, “”, {share: false})
})
.catch(
(err)=>{alert(“err: “+err)
});
} else if (this.platform.is(‘cordova’) && this.platform.is(‘ios’)) {
PhotoViewer.show(cordova.file.applicationDirectory + “www/assets/img/"+imageUrl);
}
}