Cropper: Fixed sized crop box

Created on 23 Jul 2016  路  4Comments  路  Source: fengyuanchen/cropper

Hi Team,

First thank you for such awesome plugin. I started using this plugin for my personal project, what i am doing right now is to allow user to upload profile image.

I read document about this plugin and no where i found the fixed size of the crop image. there is aspectRatio and autoCropArea but using this i can not achieve what i am trying to do.

Actually i need to define the fixed size (200w x 220h) of the crop area with "cropBoxResizable: false"

also anyone know how to display zoom function on image (zoom in and zoom out)

Does anyone know how to do it, if in case i am missing any function of this plugin please let me know.

Thank you in advance.

Most helpful comment

@fengyuanchen i undertand all the time you ask us to go whit your solution and resize on server-side.
But the point is the client need to see the crop size to.
After the croop he see the correct size of correct image. NICE.
But when he is crooping, must see the crop box on the same size he asked.
Btw tks for awesome lib. Tks for atention.

All 4 comments

I need this too.

@all, please not ask this question any more. It is not necessary to set a fixed crop box, just set a aspectRatio only, and resize the cropped image (in server-side or browser-side) to the finally fixed size as you want.

Take a fixed size of 160 x 90 pixels for example, in browser-side:

$('#myImage').cropper({
  aspectRatio: 160 / 90,
  ready: function () {
    // Get a base64 image with 160px width and 90px height.
    $(this).getCroppedCanvas({
      width: 160,
      height: 90,
    }).toDataURL() 

    // Get a base64 image with 320px width and 180px height.
    $(this).getCroppedCanvas({
      width: 320,
      height: 180,
    }).toDataURL() 

    // ... get any size if you need
  }
})

@fengyuanchen i undertand all the time you ask us to go whit your solution and resize on server-side.
But the point is the client need to see the crop size to.
After the croop he see the correct size of correct image. NICE.
But when he is crooping, must see the crop box on the same size he asked.
Btw tks for awesome lib. Tks for atention.

Please implement fixed crop box size, because the user needs to see it as well not only the server side

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SimonBriche picture SimonBriche  路  7Comments

ypcyc picture ypcyc  路  9Comments

WillJW picture WillJW  路  3Comments

niklasravnsborg picture niklasravnsborg  路  5Comments

zilions picture zilions  路  3Comments