wx.cloud.downloadfile可以将云存储的图片下载至本地相册吗?应该使用什么方法呢? 我使用wx.saveImageToPhotosAlbum报错{errMsg: “saveImageToPhotosAlbum:fail invalid file type”}(已对相册进行授权)
download: function() {
wx.getSetting({
success(res) {
if (!res.authSetting[‘scope.writePhotosAlbum’]) {
wx.authorize({
scope: ‘scope.writePhotosAlbum’,
success() {
console.log(‘授权成功’)
}
})
}
}
})
wx.cloud.downloadFile({
fileID: ‘cloud://xpr-89f120.7870-xpr-89f120/contentCzV6’, // 文件 ID
}).then(res => {
wx.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: res => {
wx.showToast({
title: ‘下载成功’,
})
},
fail: err => {
console.error(err)
}
})
}).catch(error => {
// handle error
})
download: function() {
console.log(‘aaa’)
wx.getSetting({
success(res) {
if (!res.authSetting[‘scope.writePhotosAlbum’]) {
wx.authorize({
scope: ‘scope.writePhotosAlbum’,
success() {
console.log(‘授权成功’)
}
})
}
}
})
wx.cloud.downloadFile({
fileID: ‘cloud://xpr-89f120.7870-xpr-89f120/contentCzV6’, // 文件 ID
}).then(res => {
wx.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: res => {
wx.showToast({
title: ‘下载成功’,
})
},
fail: err => {
console.error(err)
}
})
}).catch(error => {
// handle error
})