简体   繁体   English

ngx-Image-Cropper:如何在加载时和裁剪前定义宽度

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

Say I have a huge image 6000 px x 4000 px, how can I make it take up only 250 px in width in my.html?假设我有一个 6000 像素 x 4000 像素的巨大图像,我怎样才能让它在 my.html 中只占用 250 像素的宽度?

tried followings not working:尝试以下不起作用:

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

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

Note I don't want to predefine aspect ratio, II know resizeToWidth is for after cropped.注意我不想预定义纵横比,我知道resizeToWidth是用于裁剪后的。

Think outside of the box use old trick, simply use a to surround the cropper:跳出框框思考使用旧技巧,只需使用 a 包围cropper:

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

Try this example in stackblitzstackblitz中试试这个例子

[resizeToWidth]="200" should work. [resizeToWidth]="200"应该可以。 Try it again.再试一遍。

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

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