我将图像从服务器保存到设备上的本地路径
downLoad() {
this.http.downloadFile('http://example.com/files/files/image.jpg', {}, {}, 'image.jpg')
.then(data => {
console.log(data) ;
})
.catch(error => {
console.log(error) ;
});
}
但图像保存不在照片库中。怎么修理?
答案 0 :(得分:3)
您可以使用此插件执行此操作:https://github.com/terikon/cordova-plugin-photo-library
添加插件后,您可以保存以下图片:
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) {});