当使用 IMG_DATA 时,我在调整图像大小时遇到问题,但没有错误,但是当它给出此异常时,IMG_URI
调用 resizeImage 时出错:
2013-06-26 19:44:30.306 cascalho[13689:15b03] [LOG] Image Resizer Registered under window.imageResizer
2013-06-26 19:44:45.685 cascalho[13689:15b03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSDictionary initWithObjects:forKeys:]: count of objects (0) differs from count of keys (3)'
*** First throw call stack:
(0x171012 0x25c7e7e 0x17c737 0x19d8c2 0x627c 0x7563b 0x74d8c 0x7493d 0x74ad5 0x749f3 0x25db6b0 0x114a765 0xf4f3f 0xf496f 0x117734 0x116f44 0x116e1b 0x33f87e3 0x33f8668 0x3acffc 0x305c 0x2fb5)
libc++abi.dylib: terminate called throwing an exception
代码捕获:
// capture either new or existing photo:
function capture(sourceType) {
navigator.camera.getPicture(onCaptureSuccess, onCaptureFail, { quality: 40,
destinationType: Camera.DestinationType.FILE_URI ,
sourceType: sourceType,
correctOrientation: true
}
);
};
var _imageURI =null;
// if photo is captured successfully, then upload to server:
function onCaptureSuccess(imageURI) {
_imageURI = imageURI;
var largeImage = document.getElementById('largeImage');
largeImage.style.display = 'block';
largeImage.src = imageURI;
};
调用resizeImage的代码
window.imageResizer.resizeImage(
function(data) {
console.log("ah meu parana: ");
}, function (error) {
console.log("Error : \r\n" + error);
}, _imageURI,331 , 245, {
imageDataType: ImageResizer.IMAGE_DATA_TYPE_URL,
resizeType:ImageResizer.RESIZE_TYPE_PIXEL ,
format:'jpg'
}
);