Hello!
Thank you for your great plugin!
I'm using cropper.js for cover and avatar image cropping.
Users can upload cover image with fixed width(928px) and non-fixed height. But height of cropped image must be from 100px to 800px. So my question is: how can I assign to cropper min aspectratio as 928/100 and max aspectratio as 928/800.
Thank you in advance.
I'm sorry, we don't support this right now.
+1, I would really love this to be possible as well (for http://www.twitshot.com)
+1
+1
I want to upload and crop images in two different size 60_40 and 130_100
Please suggest anyone how to do this ..using this plugin
Thanks for any suggestion....
if i want to fix size of crop box selector area on image before cropping any idea if....suggest
Thanks
Here is a solution with cropmove event:
<div>
<img id="image" src="/path/to/picture.jpg">
</div>
$(function () {
var $image = $('#image');
var minAspectRatio = 1;
var maxAspectRatio = 2;
$image.cropper({
cropmove: function (e) {
var cropBoxData = $image.cropper('getCropBoxData');
var cropBoxWidth = cropBoxData.width;
var aspectRatio = cropBoxWidth / cropBoxData.height;
if (aspectRatio < minAspectRatio) {
$image.cropper('setCropBoxData', {
height: cropBoxWidth / minAspectRatio
});
} else if (aspectRatio > maxAspectRatio) {
$image.cropper('setCropBoxData', {
height: cropBoxWidth / maxAspectRatio
});
}
}
});
});
Most helpful comment
Here is a solution with
cropmoveevent: