Android 将图像从phonegap应用程序保存到手机库
我正在创建一个包含图像库的Phonegap构建应用程序。我想通过单击“保存”按钮将图像从Phonegap应用程序保存到移动多媒体资料。我尝试了几个选项,并在StackOverflow上发布了一个问题 并尝试了其他方法从应用程序下载图像,但没有代码起作用Android 将图像从phonegap应用程序保存到手机库,android,jquery,cordova,jquery-mobile,Android,Jquery,Cordova,Jquery Mobile,我正在创建一个包含图像库的Phonegap构建应用程序。我想通过单击“保存”按钮将图像从Phonegap应用程序保存到移动多媒体资料。我尝试了几个选项,并在StackOverflow上发布了一个问题 并尝试了其他方法从应用程序下载图像,但没有代码起作用 window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function' <br>'(fileSystem) { var fileTransfer = new Fi
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function' <br>'(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=="
}
}
);
});
window.requestFileSystem(LocalFileSystem.PERSISTENT,0,函数“
”(文件系统){
var fileTransfer=new fileTransfer();
var uri=encodeURI(“http://www.example.com/image");
var path=fileSystem.root.toURL()+“appName/example.jpg”;
fileTransfer.download(
乌里,
路径
功能(条目){
刷新媒体。刷新(路径);//刷新图像库
},
函数(错误){
console.log(error.source);
console.log(error.target);
console.log(错误代码);
},
假,,
{
标题:{
“授权”:“dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=”
}
}
);
});
您无法将图片保存到“多媒体资料”,因为多媒体资料应用程序是一个应用程序,没有存储空间。所以请澄清。告诉我们您尝试将image.sd卡或电话存储保存到哪个存储位置(如果可能)。现在有什么问题?你很模糊。我想在PhoneStorages中保存活动图片。我已经尝试了此代码,但它不起作用