Closed cleever closed 8 years ago
The setImage function in ImageCropperComponent needs to be changed to this:
setImage(image) {
this.cropper.setImage(image);
this.image.original = image;
this.image.image = that.cropper.getCroppedImage().src;
this.onCrop.emit(that.cropper.getCropBounds());
}
then you could also change the fileChangeListener function to:
fileChangeListener($event) {
var image:any = new Image();
var file:File = $event.target.files[0];
var fileReader:FileReader = new FileReader();
var that = this;
fileReader.onloadend = function (loadEvent:any) {
image.src = loadEvent.target.result;
that.setImage(image);
};
fileReader.readAsDataURL(file);
}
Fixed. Thanks @joerex - will be released on 0.6
In sample punkler is possible to reproduce the issue:
https://embed.plnkr.co/V91mKCNkBQZB5QO2MUP4/
When I use the integrated file input, the cropped img is set automatically.
When I use the sample cropper 2, the cropped img is only set if I move the cursor.