Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 如何在ionic中显示从相机拍摄的完整图像?_Angularjs_Ionic Framework - Fatal编程技术网

Angularjs 如何在ionic中显示从相机拍摄的完整图像?

Angularjs 如何在ionic中显示从相机拍摄的完整图像?,angularjs,ionic-framework,Angularjs,Ionic Framework,我试图用一个宽度为600、高度为800像素的img标签来显示相机拍摄的整个图像。但由于某种原因,在拍摄完一张照片后,它会被剪掉。如何将照片放入600x800像素的img元素中 以下是我的controllers.js代码: .controller('idValidationCtrl', ['$scope', '$stateParams', '$cordovaCamera','$cordovaFile', function ($scope, $stateParams,$cordovaCamera,$

我试图用一个宽度为600、高度为800像素的img标签来显示相机拍摄的整个图像。但由于某种原因,在拍摄完一张照片后,它会被剪掉。如何将照片放入600x800像素的img元素中

以下是我的controllers.js代码:

.controller('idValidationCtrl', ['$scope', '$stateParams', '$cordovaCamera','$cordovaFile', function ($scope, $stateParams,$cordovaCamera,$cordovaFile) {
 $scope.addImage = function()
{
   navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 50 });
}

//Callback function when the picture has been successfully taken
function onPhotoDataSuccess(imageData) {                
    // Get image handle
    var smallImage = document.getElementById('smallImage');

    // Unhide image elements
    smallImage.style.display = 'block';
    smallImage.src = imageData;
}

//Callback function when the picture has not been successfully taken
function onFail(message) {
    alert('Failed to load picture because: ' + message);
}

}])

我将其添加到html:style='height:100%中的标记中;宽度:100%;对象匹配:包含'