-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cannot set minimum bounds of crop box size? #254
Comments
You can limit it in the |
I do not know how we're supposed to implement this with
Beware that the automatic crop area initialization should yield a crop area that satisfies the Please note: This is not an exact size restriction. During my tests I was not able to make the cropbox smaller than 301.3341. But for most purposes it should be sufficient. |
I've the same issue and got it to work with the var cropper = new Cropper(image, {
cropmove: function(event) {
var data = cropper.getData();
if (data.width < 200) {
event.preventDefault();
data.width = 200;
cropper.setData(data);
}
if (data.height < 200) {
event.preventDefault();
data.height = 200;
cropper.setData(data);
}
}
}); This ensures that the selection is not smaller than 200 x 200 pixels. |
Bumping old thread but this is potentially a better solution;
|
@fengyuanchen Honestly it doesn't make much sense to override cropmove when you can provide only minWidth/minHeight/aspectRatio - then cropperjs have enough information to adjust cropbox size dynamically. Lets say, you have image 600x600 and you won't produce image smaller than 200px (wide or high) so you set Then cropperjs should evaluate:
And other values like minCropBoxWidth/minCropBoxHeight/etc on init/zoom/containerResize can be easily computed. |
As shocking as it sounds, I've tried like 10 different cropping libraries, none of them seem to consider this basic - normal situation. |
Apparently
minCropBoxWidth
andminCropBoxHeight
are relative to the page, not the image.So right now there is no way to set a minimum size for the to-be cropped image.
Checked old issues and has been requested plenty of times, for example:
#339
#31
The text was updated successfully, but these errors were encountered: