resolveLocalFileSystemURI错误代码5 windows phone 7 phonegap
发布时间:2020-05-22 18:10:00 所属栏目:Windows 来源:互联网
导读:我已经尝试过实施这项工作 1.拍摄一张照片 2.从保存的地方获取照片 3.将照片作为base64阅读 我遵循了这种方法: var cameraOptions = {};function capturePhoto() { console.log(capture photo); cameraOptions = { quality: 70, destinationType: Cam
|
我已经尝试过实施这项工作
我遵循了这种方法: var cameraOptions = {};
function capturePhoto() {
console.log("capture photo");
cameraOptions = { quality: 70,destinationType: Camera.DestinationType.FILE_URI,sourceType: Camera.PictureSourceType.CAMERA,saveToPhotoAlbum: true };
doIt();
}
function doIt() {
navigator.camera.getPicture(onCameraSuccess,onCameraFail,cameraOptions);
}
function onCameraSuccess(imageURI) {
console.log("Camera Success");
$('#MokhalfaPhotoLocation').val(imageURI);
console.log("Image URI: " + imageURI);
window.resolveLocalFileSystemURI(imageURI,onResolveImageSuccess,onFail); //get the file from the physical path...
}
function onResolveImageSuccess(fileEntry) {
fileEntry.file(gotFile,onFail);
}
function gotFile(file) {
readDataUrl(file);
}
function readDataUrl(file) {
console.log("read file as dataUrl");
var reader = new FileReader();
reader.onloadend = function (evt) {
console.log("Read as data URL");
window.localStorage.setItem("mokhalfaPhotoURL",evt.target.result);
};
reader.readAsDataURL(file);
}
这条链工作正常,直到CameraSuccess然后它就失败了 window.resolveLocalFileSystemURI(imageURI,onFail); 它输入了onFail事件,错误代码= 5 顺便说一下,这段代码在Android上运行良好,但问题出在Windows Phone 7上 function onCameraSuccess(imageURI) {
console.log("Camera Success");
$('#MokhalfaPhotoLocation').val(imageURI);
console.log("Image URI: " + imageURI);
window.resolveLocalFileSystemURI("//" + imageURI,onFail); //get the file from the physical path...
}
如果你警告imageURI它应该看起来像(/ CachedImagePath / etcetc /),所以window.resolveLocalFileSystemURI不知道在哪里解决,所以通过在URI前面//它看起来正确的路径. 干杯,我会将此问题发布给他们的bug追踪器 (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
- npm及cnpm(Windows)基础环境搭建
- .net – 加载Azure Storage 2.0时出错 – 无法加
- 如何使用Windows API以编程方式调整窗口大小并移
- DLL符号_FooBar @ 16中的数字16代表什么?
- Windows服务用python编写,不检测关机事件并正常停
- Atitit webdav 的问题 -------------大文件传输问
- 本地windows上安装protobuf和thrit环境
- azure – Microsoft Knowledge API – 在数据库中
- npm ERR!注册表错误解析json – 尝试在Windows
- node-ffi模块的安装以及基于electron生成windows
热点阅读
