Add save image parameter
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Willem Dantuma 2021-03-02 13:15:16 +01:00
parent 08163f86bf
commit 2b1cb1ac8f

View File

@ -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) {
if(this.saveImage) {
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");
} else {
this.changed.emit(this.croppedImage);
}
this.modalService.dismissAll("Save");
}
}
}