cstefanache / angular2-img-cropper

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

Have the result image dimension be determined by how the user cropped #116

Closed waynechaw closed 7 years ago

waynechaw commented 7 years ago

Currently, the dimension of the result image is predetermined by setting. Is it possible to make the result image dimension based on how the user cropped? For example, the result image would be a rectangle if the user cropped a rectangle out of a square image.

cstefanache commented 7 years ago

Here is a sample: you can do calculations in order to do scaling if necessary on event. https://plnkr.co/xeacNxaeHbZSpttUVGzh

Is this a good solution?

waynechaw commented 7 years ago

Hi Cornel, thanks for the fast response.

I am using the noFileInput option so it appears I will not have access to the cropped(bounds:Bounds) function to do the calculation. Do you have a solution?

Thanks again

cstefanache commented 7 years ago

cropped is an event listener for onCrop event triggered by img-cropper component. If you bind it then you should have access to it. eg: (onCrop)="cropped($event)"

waynechaw commented 7 years ago

thank you