簡體   English   中英

ngx-Image-Cropper:如何在加載時和裁剪前定義寬度

[英]ngx-Image-Cropper: how to define width when loaded and before cropped

假設我有一個 6000 像素 x 4000 像素的巨大圖像,我怎樣才能讓它在 my.html 中只占用 250 像素的寬度?

嘗試以下不起作用:

<image-cropper width="50px"...>

<image-cropper [resizeToWidth]="250"...>

注意我不想預定義縱橫比,我知道resizeToWidth是用於裁剪后的。

跳出框框思考使用舊技巧,只需使用 a 包圍cropper:

<div #cropContainer style="display: block; width: 100px"><image-cropper ...></div>

stackblitz中試試這個例子

[resizeToWidth]="200"應該可以。 再試一遍。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM