2016-01-26 65 views
1

我正在使用離子模塊cordovaCapturecordovaCapture captureImage not reading options

但它不讀我通過一個可變的選項:

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'); 
}); 

拍攝的圖像不糾正他的方向,可是沒有寬度或高度最大1280px和它一直保存到photoAlbum ..什麼是設置選項的正確方法?

回答

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 
    });