cstefanache / angular2-img-cropper

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

Unable to add custom values in onCrop method #304

Open rkreddysp opened 4 years ago

rkreddysp commented 4 years ago

Hi Team, I am trying to get custom dimensions(16:9), but i am unable to assign them in oncrop method. It is taking default dimensions.

tileImageCropped1(bounds: Bounds) { var minHeight: number = parseInt(this.CropMinHeight); var aspectrationheight = Math.round((bounds.width/16)*9); this.cropperSettings.width = bounds.width; this.cropperSettings.height = aspectrationheight; if (bounds.width >= parseInt(this.CropMinWidth) && aspectrationheight >= minHeight) { this.cropperSettings.croppedHeight = aspectrationheight; this.cropperSettings.croppedWidth = bounds.width ;
this.isValidCropping = true; } else { this.isValidCropping = false; } }

Can you please help me to fix the issue.