0

I save image from server to local path on device

downLoad() {
    this.http.downloadFile('http://example.com/files/files/image.jpg', {}, {}, 'image.jpg')
    .then(data => {
        console.log(data) ;
    })
    .catch(error => {

        console.log(error) ;

    });

}

But image save not in Photo Gallery. How it fix?

wstudiokiwi
  • 880
  • 1
  • 15
  • 33
  • 1
    Possible duplicate of [Phonegap - Save image from url into device photo gallery](https://stackoverflow.com/questions/21577230/phonegap-save-image-from-url-into-device-photo-gallery) – pro_cheats Jun 23 '17 at 10:16

1 Answers1

3

You can do that with this plugin: https://github.com/terikon/cordova-plugin-photo-library

After adding the plugin, you can save pictures like that:

var url = 'file:///...'; // file or remote URL. url can also be dataURL, but giving it a file path is much faster
var album = 'MyAppName';
cordova.plugins.photoLibrary.saveImage(url, album, function (libraryItem) {}, function (err) {});
Andreas Gassmann
  • 6,334
  • 7
  • 32
  • 45