Cordova android无法从缓存目录中复制图像

Cordova android无法从缓存目录中复制图像,第1张

概述我有一个工作的应用程序拍照,但我想将图片从缓存文件夹复制或移动到另一个文件夹.我不能这样做,它返回错误[对象对象]. 问候 function copiePhoto() {try { var fail = function (err) { alert(err); }; window.resolveLocalFileSystemURI("file:///sto 我有一个工作的应用程序拍照,但我想将图片从缓存文件夹复制或移动到另一个文件夹.我不能这样做,它返回错误[对象对象].

问候

function copIEPhoto() {try {    var fail = function (err) {        alert(err);    };    window.resolveLocalfileSystemURI("file:///storage/emulated/0/AndroID/data/com.coolappz.cAPIgo/cache/1427968060754.jpg",function (file) {        window.resolveLocalfileSystemURI("file:///test",function (destination) {            file.moveto(destination,"test.jpg");        },fail);    },fail);} catch (err) {    alert("copIE : " + err);}

}

解决方法 经过几个小时的工作,我做到了:

function recupImage(imageURI) {    window.resolveLocalfileSystemURI(imageURI,copIEPhoto,fail);    }function copIEPhoto(fileEntry) {    window.requestfileSystem(LocalfileSystem.PERSISTENT,function(fileSys) {         fileSys.root.getDirectory("photos2",{create: true,exclusive: false},function(dir) {                 fileEntry.copyTo(dir,fileEntry.name,oncopySuccess,fail);             },fail);     },fail); }function oncopySuccess(entry) {    alert('image copié dans le chemin : ' + entry.fullPath);}function fail(error) {    alert(error.code);}
总结

以上是内存溢出为你收集整理的Cordova android无法从缓存目录中复制图像全部内容,希望文章能够帮你解决Cordova android无法从缓存目录中复制图像所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1000801.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-21
下一篇 2022-05-21

发表评论

登录后才能评论

评论列表(0条)

保存