Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cropper.replace issue #44

Open
YouNone opened this issue Sep 5, 2019 · 1 comment
Open

cropper.replace issue #44

YouNone opened this issue Sep 5, 2019 · 1 comment

Comments

@YouNone
Copy link

YouNone commented Sep 5, 2019

I have a problem with replacing an image.
I have a component in wich on button click I pick image to input in cropper. But, if I choose to repick it cropper sets out two images in cropper. Im using cropper.replace, but its doesnt change anything.

img
`
@ViewChild('cropperObj', { static: false }) public cropperObj: CropperComponent;

imageSelected: boolean = false;
imgURL: any = 'img/user_none.svg';
croppedImg: string;

onFileSelect(e) {
let files = e.target.files;
var mimeType = files[0].type;
if (mimeType.match(/image/*/) == null) {
alert("Only images are supported.");
return;
}
let reader = new FileReader();
reader.readAsDataURL(files[0]);
reader.onloadend = (_event) => {
console.log(this.cropperObj.cropper);
this.croppedImg = "" + reader.result
this.cropperObj.cropper.replace(this.croppedImg);
}
this.imageSelected = true;
}`

@nishantniket
Copy link

same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants