fengyuanchen / cropper

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

There is a way of saving image in specific sizes? #947

Closed priMo-ex3m closed 6 years ago

priMo-ex3m commented 6 years ago

Hello, dude! I know that question probably is more for back-end part, but may be you have implemented in your plugin smth that can solve it in front end : If user uploads a full hd image, I fixed the minimum width and height of crop-box as 200x200, and disabled resize of the box. I also set img#image as max-width: 100%; So, when I upload a photo full hd photo, it opens in a modal like thumbnail of 468x263. And with my "200x200 crop-box" after crop, uploaded image has size of 863x863px. Is there a way how can I trick it to achieve output as images of 200x200 px? Thank you!

fengyuanchen commented 6 years ago

Please check out the docs of getCroppedCanvas method.

In short:

$().cropper('getCroppedCanvas', {
  width: 200,
  height: 200,
}); // Generate a image with 200 * 200 px
priMo-ex3m commented 6 years ago

It works. Thanks!