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