我使用离子与cordovaCapture
模块。
但它并没有读作我作为变量传递的选项:
var options = {
limit: 1,
quality: 100,
targetWidth: 1280,
targetHeight: 1280,
correctOrientation: true,
saveToPhotoAlbum: false
};
$cordovaCapture.captureImage(options).then(function (imageData) {
var imgData = imageData[0].fullPath;
// here I upload them to remote Server
}, function (error) {
alert('error');
});
所拍摄的图像未经过校正,没有宽度或高度达到最大1280像素,并且它总是保存到photoAlbum ..设置选项的正确方法是什么?
答案 0 :(得分:0)
您使用的是$cordovaCapture还是$cordovaCamera?
第一个选项非常有限;检查:https://github.com/apache/cordova-plugin-media-capture
第二个更完整;校验: https://github.com/apache/cordova-plugin-camera#module_camera.CameraOptions
但要捕获的API是:
var options = {
quality: 50,
destinationType: Camera.DestinationType.DATA_URL,
sourceType: Camera.PictureSourceType.CAMERA,
allowEdit: true,
encodingType: Camera.EncodingType.JPEG,
targetWidth: 100,
targetHeight: 100,
popoverOptions: CameraPopoverOptions,
saveToPhotoAlbum: false,
correctOrientation:true
};
$cordovaCamera.getPicture(options).then(function(imageData) {
var image = document.getElementById('myImage');
image.src = "data:image/jpeg;base64," + imageData;
}, function(err) {
// error
});