angularjs – 从图库中选择图像时的离子图像裁剪

前端之家收集整理的这篇文章主要介绍了angularjs – 从图库中选择图像时的离子图像裁剪前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在离子v1和角度v1中使用了cordova插件相机.
当我们从相机拍摄照片时,插件本身为裁剪图像提供选项.但是从照片库中选择图像中没有选项.

$scope.choosePhoto = function () {
                    var options = {
                    quality: 75,destinationType: Camera.DestinationType.DATA_URL,sourceType: Camera.PictureSourceType.PHOTOLIBRARY,allowEdit: true,encodingType: Camera.EncodingType.JPEG,targetWidth: 200,targetHeight: 200,popoverOptions: CameraPopoverOptions,saveToPhotoAlbum: true
                };

             $cordovaCamera.getPicture(options).then(function (imageData) {
                        $scope.imgURI = "data:image/jpeg;base64," + imageData;
                        window.localStorage.setItem('image',($scope.imgURI));
                    },function (err) {
                        // An error occured. Show a message to the user
                    });
                }

在选择图库图像时是否有任何图像裁剪解决方案..
对于我的项目,我也使用cordova插件作物.
有一个选项,如,

plugins.crop.promise('/path/to/image',options)
.then(function success (newPath) {

})
.catch(function fail (err) {

})

但它不起作用,它只适用于Android我猜…

有谁知道这个请帮忙吗?

解决方法

如果要在iOS中访问它,则需要在targetWidth,targetHeight中提供高分辨率图像.
尝试添加

targetWidth: 2000,targetHeight: 2000

它适用于iOS和Android.

猜你在找的Angularjs相关文章