Answer the question
In order to leave comments, you need to log in
How to save an image via Photo Library in ionic?
Hello. I'm trying to save an image to the gallery in ionic. But I ran into such a problem that the links of the form
http://site.com/photo-1415?param1=value¶m2=value
are not accepted, the file is not saved. http://site.com/photo.jpg
work. import { PhotoLibrary } from '@ionic-native/photo-library';
constructor(public navCtrl: NavController, private photoLibrary: PhotoLibrary) {
}
saveImage(i) {
const imageUrl = this.images[i].urls.full;
console.log(imageUrl);
this.photoLibrary.requestAuthorization().then(() => {
this.photoLibrary.saveImage(imageUrl, 'MyAlbum').then(function () {
console.log("Promise Resolved");
}).catch(function () {
console.log("Promise Rejected");
});
}).catch(err => console.log('permissions weren\'t granted'));
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question