I used cordova plugin camerain ionic v1 and angular v1. The plugin itself provides the ability to crop images when we take an image from the camera .. but there is no option in choosing an image from the photo library.
$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) {
});
}
Is there any solution for cropping the image during gallery image selection. for my project i also use cordova plugin cropfor this. there is an option, for example,
plugins.crop.promise('/path/to/image', options)
.then(function success (newPath) {
})
.catch(function fail (err) {
})
but its not working, and this is only for android, I think ..
who knows about this, please help?
source
share