Add save image parameter
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
This commit is contained in:
parent
08163f86bf
commit
2b1cb1ac8f
@ -25,17 +25,19 @@ export class EditImageModalComponent implements OnInit {
|
|||||||
maxWidth:number = 200;
|
maxWidth:number = 200;
|
||||||
roundImage:boolean = false;
|
roundImage:boolean = false;
|
||||||
imageType:string = "jpeg";
|
imageType:string = "jpeg";
|
||||||
|
saveImage:boolean = true;
|
||||||
|
|
||||||
ngOnInit(): void {
|
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.endpointUrl = endpoint;
|
||||||
this.imageUrl = endpoint;
|
this.imageUrl = endpoint;
|
||||||
this.aspectRatio= aspectRatio;
|
this.aspectRatio= aspectRatio;
|
||||||
this.roundImage = roundImage === undefined?this.roundImage:roundImage;
|
this.roundImage = roundImage === undefined?this.roundImage:roundImage;
|
||||||
this.maxWidth = maxWidth === undefined?this.maxWidth:maxWidth;
|
this.maxWidth = maxWidth === undefined?this.maxWidth:maxWidth;
|
||||||
this.imageType = imageType === undefined?this.imageType:imageType.substr(6);
|
this.imageType = imageType === undefined?this.imageType:imageType.substr(6);
|
||||||
|
this.saveImage = saveImage === undefined?this.saveImage:saveImage;
|
||||||
this.modalService.open(this.modal,{ size: 'lg' });
|
this.modalService.open(this.modal,{ size: 'lg' });
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,12 +59,15 @@ export class EditImageModalComponent implements OnInit {
|
|||||||
|
|
||||||
save() {
|
save() {
|
||||||
if(this.croppedImage) {
|
if(this.croppedImage) {
|
||||||
|
if(this.saveImage) {
|
||||||
var body = this.croppedImage.substr(23);
|
var body = this.croppedImage.substr(23);
|
||||||
this.imageService.putImage(this.endpointUrl,this.imageService.b64toBlob(body,"image/jpeg")).subscribe(() => {
|
this.imageService.putImage(this.endpointUrl,this.imageService.b64toBlob(body,"image/jpeg")).subscribe(() => {
|
||||||
this.changed.emit({});
|
this.changed.emit({});
|
||||||
});
|
});
|
||||||
this,this.modalService.dismissAll("Save");
|
} else {
|
||||||
|
this.changed.emit(this.croppedImage);
|
||||||
|
}
|
||||||
|
this.modalService.dismissAll("Save");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user