tôi đã cố gắng thực hiện công việc này khoảng 1. chụp một bức ảnh 2. Nhận ảnh từ nó được lưu nơi 3. đọc ảnh dưới dạng base64resolveLocalFileSystemURI mã lỗi 5 windows phone 7 PhoneGap
tôi đã theo phương pháp này:
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);
}
chuỗi này làm việc tốt cho đến khi CameraSuccess sau đó nó thất bại trên dòng
window.resolveLocalFileSystemURI(imageURI, onResolveImageSuccess, onFail);
nó bước vào sự kiện onFail Với mã lỗi = 5
btw, mã này hoạt động tốt trên Android nhưng vấn đề là ở đây với Windows Phone 7 bất kỳ ai biết vấn đề là gì?