I am currently implementing a feature using ngx-image-cropper
import { ImageCroppedEvent, ImageTransform } from 'ngx-image-cropper';
user={ ..
};
image: any = '';
croppedImage: any = '';
transform: ImageTransform = {};
scale = 1;
showCropper = false;
profilePicUpload(e): void {
this.imageChangedEvent = e;
this.image = e.target.files[0];
}
imageCropped(event: ImageCroppedEvent) {
this.user.photo = event.base64;
this.croppedImage = event.base64.substring(22);
}
imageLoaded() {
this.showCropper = true;
}
async addImg() {
if(this.image){
const path = await this.UploadService.uploadFile(this.image);
await new Promise(f => setTimeout(f, 2000));
this.user.photo = '';
this.user.photo += path;
}
}
Used the above code to upload an image but encountered an issue where the cropped image is not being saved, only the original image is saved.
If you have any solution for this, I would greatly appreciate it. Thank you!