I'm having trouble with the Cordova camera plugin and ionic 2. Here is my code.
Camera.getPicture({
targetWidth: 1500,
targetHeight:2500,
quality: 80,
destinationType: Camera.DestinationType.DATA_URL,
allowEdit: true,
encodingType: Camera.EncodingType.JPEG,
sourceType: Camera.PictureSourceType.CAMERA,
correctOrientation: true
})
My problem is that as soon as the user changes the crop, the image distorts. If I make the width and height the same, then it makes a square and doesn't allow the box size to change and the crop works fine, but with different values for width and height, it allows the user to edit the box ration and then it distorts the image.
Am I missing a trick here? It feels like it shouldn't allow me to modify the cropping box size?
I was facing the same problem, I have work around .
In my application,
I am not setting target width and height for plugin, as well as not using allowEdit option.
Instead of that I am taking base64 string from plugin, apply it on image and use cropper.js for cropping capture image.
So I always get image with required aspect ratio.
Also for better user experience I am applying face detection using external js as like cropper.js
Hope this will help you.