在离子应用程序中,我想拍照,然后在图像中显示。
$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中,考虑保护&#39;文件下的图像:&#39;
但是,再次,没有结果。
任何帮助????
的Massimo
答案 0 :(得分:2)
尝试以下方法,
$cordovaCamera.getPicture(options).then(function (imageData)
{
var data = imageData;
var image = document.getElementById('myImage');
image.src = data.split('?')[0];
})
答案 1 :(得分:0)
试试这个......
.category-23 h2:last-child