ImageResizer返回最接近的图像断点 [英] ImageResizer return closest image breakpoint

查看:182
本文介绍了ImageResizer返回最接近的图像断点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

像@Nathanael琼斯回答这里 ImageResizer库的有preset中来创建某种断点。

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

1º - 320w- 213h

2° - 453w- 302H

2º - 453w- 302h

3° - 579w- 386h

3º - 579w- 386h

等..

我的问题是我能要求如图像W = 300安培; H = 200。,并返回我最亲密的断点,在这种情况下是第一个

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

推荐答案

有什么内置挑$ P $的pset你,或者嵌入到最近的一个。这就是说,它很容易使用 Config.Current.Pipleine.Rewrite 事件,在那里你可以访问实施 e.QueryString [宽度] e.QueryString [高度] ,并改变这些值也是如此。

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.

这篇关于ImageResizer返回最接近的图像断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆