P
P
Pavel2018-03-29 15:17:56
Android
Pavel, 2018-03-29 15:17:56

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&param2=value
are not accepted, the file is not saved.
Regular view links http://site.com/photo.jpgwork.
here is a sample code
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 question

Ask a Question

731 491 924 answers to any question