cstefanache / angular2-img-cropper

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

How to dynamic reset the cropperSettings. width & heigth #153

Open yunClouds opened 7 years ago

yunClouds commented 7 years ago

who can tell me thanks ,I do like this image ,But its do not worked...

cstefanache commented 7 years ago

hmmm... that might be tricky - the problem is that you need to reinitialize the cropper for this because the magic happens within the constructor. What is the use case for this feature? Do you need it ASAP? Can this be postponed for 1.0? (currently working on 0.9)

yunClouds commented 7 years ago

@cstefanache Application scenarios:I need to get pictures of different sizes for different third party API. So I want this feature, and that is ok to be postponed for 1.0,I hope to see that . finally, Thanks alot cstefanache

piotrn1 commented 7 years ago

You can try using something like this: this.cropper.cropper = new ImageCropper(this.cropperSettings); this.cropper.cropper.prepare(this.cropper.cropcanvas.nativeElement);

kudsyf commented 7 years ago

@piotrn1 i tried the above code, it didnt work, after running the prepare method the image will replaced with a blank (gray). any idea how to make that work ? i need to change my crop setting from landscape to portrait at dun time

diannall commented 6 years ago

i need to be able to change settings also... has this been added?

diannall commented 6 years ago

My use case: I want the user to be able to select the crop ratio.

treyer commented 6 years ago

Like @diannall I'd like user to be able by clicking +/- buttons change compressRatio setting - now I have possibility only change ratio but how to initialize result image change?

ericcancil commented 6 years ago

Is there any update on this? I would like to be able to update the canvasWidth and canvasHeight

MNorgren commented 6 years ago

Also curious on an update. I want to allow the users to toggle the "Lock aspect ratio" feature. Trying to figure out a work-around right now to reload the cropper, however not having a whole lot of luck.

If anyone has a work around for now, that would be appreciated. Thanks!

marty331 commented 6 years ago

Are there any updates on this feature?

hudsonsilvaoliveira commented 6 years ago

Thanks @piotrn1 this worked for me. More details here: https://github.com/web-dave/ngx-img-cropper/issues/8#issuecomment-376651830