ImageResizer return closest image breakpoint

别说谁变了你拦得住时间么 提交于 2019-12-11 14:52:06

问题


Like @Nathanael Jones answered here ImageResizer library have "Presets" to create some kind of breakpoints.

I want have breakpoints as I mentioned on my other question:

1º - 320w- 213h

2º - 453w- 302h

3º - 579w- 386h

and so on..

My question is can I request an image like "?w=300&h=200", and return my closest breakpoint, in this case was first one.


回答1:


There's nothing built-in to pick presets for you, or "snap" to the closest one. That said, it's easy to implement using the Config.Current.Pipleine.Rewrite event, where you can access e.QueryString["width"] and e.QueryString["height"], and change those values as well.



来源:https://stackoverflow.com/questions/35479931/imageresizer-return-closest-image-breakpoint

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!