cstefanache / angular2-img-cropper

Angular 2 Image Cropper
MIT License
364 stars 135 forks source link

How to use cropperWidth/Height when keepAspect is false #69

Closed joerex closed 8 years ago

joerex commented 8 years ago

I don't see a way to have the cropperWidth and cropperHeight settings automatically adjust based on the aspect ratio. This isn't possible currently, right?

cstefanache commented 8 years ago

Hello, please check out this plnkr: https://embed.plnkr.co/Hh0TKRpXzIy6MJOwy8KT/

it is built on top of an older version of the cropper but I think that the cropped event is triggered

joerex commented 8 years ago

Thanks, I was able to fork and modify from the most recent version. What I did works for my use case because I always want the largest crop possible, so I just get the crop bounds before the crop and send the fillWidth and fillHeight to the getCroppedImage function and I don't set a cropperWidth or Height.

In general, it would make sense to me if cropperWidth/Height were more like cropperMaxWidth/Height. Then you could use them or not and let the aspect ratio determine the shape of the crop, and resize the canvas after the crop based on max dimensions.