diff --git a/projects/common/src/fm/components/edit-image-modal/edit-image-modal.component.ts b/projects/common/src/fm/components/edit-image-modal/edit-image-modal.component.ts index c43eb88..a9ab44c 100644 --- a/projects/common/src/fm/components/edit-image-modal/edit-image-modal.component.ts +++ b/projects/common/src/fm/components/edit-image-modal/edit-image-modal.component.ts @@ -25,17 +25,19 @@ export class EditImageModalComponent implements OnInit { maxWidth:number = 200; roundImage:boolean = false; imageType:string = "jpeg"; + saveImage:boolean = true; ngOnInit(): void { } - open(endpoint:string,aspectRatio:number,roundImage?:boolean,maxWidth?:number, imageType?:string) { + open(endpoint:string,aspectRatio:number,roundImage?:boolean,maxWidth?:number,saveImage?:boolean, imageType?:string) { this.endpointUrl = endpoint; this.imageUrl = endpoint; this.aspectRatio= aspectRatio; this.roundImage = roundImage === undefined?this.roundImage:roundImage; this.maxWidth = maxWidth === undefined?this.maxWidth:maxWidth; this.imageType = imageType === undefined?this.imageType:imageType.substr(6); + this.saveImage = saveImage === undefined?this.saveImage:saveImage; this.modalService.open(this.modal,{ size: 'lg' }); } @@ -57,12 +59,15 @@ export class EditImageModalComponent implements OnInit { save() { if(this.croppedImage) { - - var body = this.croppedImage.substr(23); - this.imageService.putImage(this.endpointUrl,this.imageService.b64toBlob(body,"image/jpeg")).subscribe(() => { - this.changed.emit({}); - }); - this,this.modalService.dismissAll("Save"); + if(this.saveImage) { + var body = this.croppedImage.substr(23); + this.imageService.putImage(this.endpointUrl,this.imageService.b64toBlob(body,"image/jpeg")).subscribe(() => { + this.changed.emit({}); + }); + } else { + this.changed.emit(this.croppedImage); + } + this.modalService.dismissAll("Save"); } } }