【发布时间】:2016-07-11 12:06:53
【问题描述】:
如何使用 cordova 应用程序将 base64 图像保存到设备库中。我正在获取 base64 文本作为响应。
【问题讨论】:
标签: angularjs cordova ionic-framework phonegap-plugins phonegap-cli
如何使用 cordova 应用程序将 base64 图像保存到设备库中。我正在获取 base64 文本作为响应。
【问题讨论】:
标签: angularjs cordova ionic-framework phonegap-plugins phonegap-cli
你可以在这里找到http://ionicframework.com/docs/v2/native/base64-to%20gallery/
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (fileSystem) {
var fileTransfer = new FileTransfer();
var uri = encodeURI("http://www.example.com/image");
var path = fileSystem.root.toURL() + "appName/example.jpg";
fileTransfer.download(
uri,
path,
function(entry) {
refreshMedia.refresh(path); // Refresh the image gallery
},
function(error) {
console.log(error.source);
console.log(error.target);
console.log(error.code);
},
false,
{
headers: {
"Authorization": "dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=="
}
}
);
});
【讨论】: