简体   繁体   English

如何将 ngx-image-cropper 的图像宽度限制为其弹出容器

[英]How to limit the image width of ngx-image-cropper to its popup container

I have a popup with dimension (WIDTH,HEIGHT) and ngx-image-cropper ( https://www.npmjs.com/package/ngx-image-cropper ) inside我有一个弹出窗口,里面有尺寸 (WIDTH,HEIGHT) 和 ngx-image-cropper ( https://www.npmjs.com/package/ngx-image-cropper )

<div mat-dialog-container>

    <image-cropper
        [imageBase64]="imageFile"
        [maintainAspectRatio]="true"
        [aspectRatio]="aspectRatio"    
        [cropperStaticWidth]="cropperStaticWidth"
        [cropperStaticHeight]="cropperStaticHeight"
        [hideResizeSquares]="true"
        format="png"
        (imageCropped)="imageCropped($event)"
        (imageLoaded)="imageLoaded()"
        (cropperReady)="cropperReady()"
        (loadImageFailed)="loadImageFailed()"
    ></image-cropper> 
</div>

in my example, the imageFile size is 819 * 202 and when I inspect the img tag of (dimension: width= 749,933; height=184,967) it exceeds the dimension of the popup (in my case, width = 698)在我的示例中,imageFile 大小为 819 * 202,当我检查 (dimension: width= 749,933; height=184,967) 的 img 标签时,它超出了弹出窗口的尺寸(在我的情况下,宽度 = 698)

I want the tag width of fit the width of the popup with a margin of 10px on left side as well as right side我希望标签宽度适合弹出窗口的宽度,左侧和右侧的边距为 10px

Sorry, I am dizzy, I put by mistake a div as container of tag image-cropper with width = 460 and height = 425. I removed it and now it is working.抱歉,我头晕,我错误地将 div 作为标签图像裁剪器的容器,宽度 = 460,高度 = 425。我删除了它,现在它可以工作了。

Sorry again再次抱歉

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM