0
在離子應用程序中,我想拍攝一張照片,然後在圖像中顯示該照片。Android上的Ionic cordova-plugin-camera大問題
$scope.takePicture = function() {
var options = {
quality: 50,
destinationType: Camera.DestinationType.FILE_URI,
sourceType: Camera.PictureSourceType.CAMERA,
allowEdit: false,
encodingType: Camera.EncodingType.JPEG,
targetWidth: 640,
targetHeight: 640,
mediaType: Camera.MediaType.PICTURE,
saveToPhotoAlbum: false,
correctOrientation:true
};
$cordovaCamera.getPicture(options).then(function (imageData) {
var image = document.getElementById('myImage');
image.src = imageData;
})
}
iOS上一切正常,並在我的應用我看到
在Android上的形象,我什麼也沒看到!但圖像被正確保存,因爲我可以在我的服務器中發送圖像文件而沒有任何問題。
我嘗試添加:
<allow-navigation href="file:*"/>
在我的config.xml中,我補充一下:
<meta http-equiv="Content-Security-Policy" content="default-src *; script-src 'self' 'unsafe-inline' 'unsafe-eval' *; style-src 'self' 'unsafe-inline' *; img-src 'self' data: file: *">
在我的index.html,考慮安全下的圖片 '文件:'
但是,沒有結果。
任何幫助?
馬西莫