我只想保存图像 base64 并在图库中打开它。我不想从画廊获取照片或拍照。
<img src="base64" />
<button>Save</button>
电话间隙 + AngularJS
Thanks!
解决方案:
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=="
}
}
);
});
我需要创建一个插件来刷新图片库,因为当您在 Android 设备上保存图像时,该图像不会出现在图库中。该插件更新图片库。
refreshMedia.refresh(path); // Refresh the image gallery
Plugin: https://github.com/guinatal/refreshgallery https://github.com/guinatal/refreshgallery
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)