将图像缩放为角度固定大小 [英] Scale image to a fixed size in angular
问题描述
我要求将图像缩放到固定大小。我正在寻找一个选项来通过角度客户端而不是后端服务实现这一目标。请参阅下面链接中的示例#2 - 缩放到固定大小,以获取我想要从Angular获得的要求。 https://www.codeproject.com/Articles/2941/Resizing-a-Photographic-image-with-GDI-for-NET
如果有人知道如何实现它,请现在就告诉我。
我的尝试:
我试过c#.net有效的方法,但希望通过客户端实现。
I have requirement where I want to scale image to fixed size. I am looking for an option to achieve that through angular client side instead from backend service. Please refer "Example #2 - Scale to a fixed size" from below link for the requirement which I want to achieve from Angular. https://www.codeproject.com/Articles/2941/Resizing-a-Photographic-image-with-GDI-for-NET
Please let me now if there’s anyone knows how to achieve it.
What I have tried:
I have tried c#.net approach which works but looking to implement through client side.
推荐答案
你想要做的是找到一个在Angular中调整大小的包,然后在固定的工作 - 大小限制。如果您搜索它们,Google会有很多结果。
使用ng2-img-max在Angular中调整浏览器中的图像大小 [ ^ ]
角度指令 - 在不改变图像宽高比的情况下设置图像高度和宽度mytechnetknowhows [ ^ ]
我在其他项目中使用了blue-imp并取得了成功(在第一个链接的代码)
What you would want to do then is to find a package resizing in Angular, and then work in the fixed-size limits. Google has plenty of results if you search for them.
Resizing Images in the Browser in Angular With ng2-img-max[^]
Angular Directive – Setting image height and width without changing the image aspect ratio | mytechnetknowhows[^]
I have used "blue-imp" in other projects with success (in the code at first link)
这篇关于将图像缩放为角度固定大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!