ImageResizer: Resize based on filename

China☆狼群 提交于 2019-12-25 01:24:27

问题


Instead of specifying width and height in the querystring like this:

http://example.com/media/cow/small.png?w=100&h=100

Is it possible to configure Imageresizer to look at the filename (small.png) and use this information to scale it to 100x100?

This would allow me to request images like this:

http://example.com/media/cow/small.png
http://example.com/media/cow/big.png

回答1:


This is usually called URL rewriting. See

  • Using ImageResizer with a custom naming convention
  • How can I set up custom ImageResizer URLs
  • Web.config rewrite rule
  • UrlRewrite IIS to make existing image urls work with ImageResizer
  • ImageResizer custom urls for bundled effects

We also define a Config.Pipeline.Defaults event to let people change default settings. It's just like URL rewriting, but provides 'default' behavior and only affects processed images.



来源:https://stackoverflow.com/questions/28027545/imageresizer-resize-based-on-filename

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