问题
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