'How to set maximum cropbox size in cropperjs?

Hello i just want to ask how can i set the maximum size of my cropbox? Because i got a image frame which have a 400x400 image size then inside of it is a box container which going to be the place where the cropped image from the cropbox go.

I have this jQuery code

var img = $('#image');
$('#image').on('load', function () {
  img.cropper({
    aspectRatio         : 1,
    scalable            : true,
    rotatable           : true,
    checkOrientation    : true,
    cropBoxResizable    : true,
    dragMode            : 'move',
    minCropBoxWidth     : 346,
    minCropBoxHeight    : 269,
    minContainerHeight  : 400,
    minContainerWidth   : 400,
    minCanvasWidth      : 400,
    minCanvasHeight     : 400,
    viewMode            : 1
  });
  img.cropper("setCropBoxData", { width: "346", height: "269" });
}

It works normal but no changes have been made with my cropbox. It only set its minimum size but not the maximum. Any solutions will help thanks.



Solution 1:[1]

You can add this :

autoCropArea: 1,

Solution 2:[2]

Try adding style="max-height:80vh !important" to the parent container for the cropper-container cropper-bg class.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Crocrodail
Solution 2 Kerwin Thompson