我需要在编辑后保存图像并将其裁剪到特定目录中 但它给出了错误。
图片网址
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAoCAYAAACfKfiZAAAA9ElEQVRYhdXUuw0CMQwGYBdwgooKCV
代码
function SavePic(file){
var d = new Date();
var n = d.getTime();
//new file name
var newFileName = n + ".jpg";
currentDir.getFile(newFileName,{create: true,exclusive:false},function gotFileEntry(fileEntry){
var path = fileEntry.fullPath.replace(newFileName,"");
fileEntry.remove();
var fileTransfer = new FileTransfer();
fileTransfer.download(file, path+""+fileName,function(theFile){
alert("File Downloaded Successfully");
},function(error){
alert("File Download Failed"+ error.code);
});
},fail);
}
因为我得到"文件下载失败"警告来自错误功能