fengyuanchen / cropper

⚠️ [Deprecated] No longer maintained, please use https://github.com/fengyuanchen/jquery-cropper
MIT License
7.75k stars 1.74k forks source link

Problems with large image #877

Closed rodrigobahia closed 7 years ago

rodrigobahia commented 7 years ago

Hi,

I need crop the image to size 1024px x 1024px.

Is possible made this cut with a box of 400px X 400px?

I need of a small box but the image size final in 1024px.

Thanks

fengyuanchen commented 7 years ago

Of course. The cropper support this by default. For example:

$('img').cropper({
  aspectRatio: 1, // 1024 / 1024
  ready: function () {
    // Get a 1024px x 1024px cropped canvas
    var croppedCanvas = $(this).cropper('getCroppedCanvas', {
      width: 1024,
      height: 1024,
    });

    // Get a 1024px x 1024px cropped JPEG image
    var croppedImage = croppedCanvas.toDataURL('image/jpeg');
  }
})