Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async cropImage(imageSource) {
try {
const imageCropper: ImageCropper = new ImageCropper();
const result: ImageSource = (await imageCropper.show(imageSource,
{width: 150, height: 140, lockSquare: false})).image;
if (result) {
this.profileImage.image = `data:image/jpeg;base64,${result.toBase64String('jpeg', 100)}`;
this.saveProfileImage();
this.cd.detectChanges();
}
} catch (error) {
console.error(error);
}
}
source.fromAsset(imageAsset).then((picture) => {
var imageCropper = new ImageCropper();
imageCropper.show(picture).then(function(args){
self.image_src = args.image;
})
.catch(function(e){
console.log(e);
});
});
}).catch((err) => {
constructor() {
super();
this.imageCropper = new ImageCropper();
setTimeout(() => {
this.croppedImage = frameModule.topmost().getViewById("croppedImage");
}, 1000);
}