【发布时间】:2021-05-04 07:13:17
【问题描述】:
使用当前代码默认加载图像时,我正在裁剪,但我想要的是当我点击裁剪按钮时,只有裁剪应该发生
我在谷歌中检查了几个我得到了 autoCrop:false 但我不确定我需要放在哪里
这是 HTML 代码
<image-cropper
[imageChangedEvent]="imageChangedEvent"
[maintainAspectRatio]="true"
[aspectRatio]="4 / 3"
[resizeToWidth]="128"
format="png"
(imageCropped)="imageCropped($event)"
(imageLoaded)="imageLoaded()"
(cropperReady)="cropperReady()"
(loadImageFailed)="loadImageFailed()" style="max-height:500px">
这是 TS 代码
//cropping process done here
cropImage(imgId) {
this.currentProcessingImg = imgId;
var imgObj = this.ulpoadedFiles.find(x => x.imgId === imgId);
//created dummy event Object and set as imageChangedEvent so it will set cropper on this image
var event = {
target: {
files: [imgObj.imgFile]
}
};
this.imageChangedEvent = event;
}
提前致谢
【问题讨论】:
标签: angular typescript angular8 ngx-image-cropper