好记性不如烂笔头。

ImageResizer动态输出图像宽高

在nuget中执行安装命令:

PM> Install-Package ImageResizer.WebConfig
PM> Install-Package ImageResizer.Plugins.DiskCache
PM> Install-Package ImageResizer.Plugins.PrettyGifs

在Application_Start中添加如下代码

new ImageResizer.Plugins.PrettyGifs.PrettyGifs().Install(ImageResizer.Configuration.Config.Current);
new ImageResizer.Plugins.DiskCache.DiskCache().Install(ImageResizer.Configuration.Config.Current);

英文文档:https://imageresizing.net/docs/v4

相关的web.config配置

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="resizer" type="ImageResizer.ResizerSection" requirePermission="false" />
</configSections>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<httpModules>
<add name="ImageResizingModule" type="ImageResizer.InterceptModule" />
</httpModules>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules>
<add name="ImageResizingModule" type="ImageResizer.InterceptModule" />
</modules>
</system.webServer>
<resizer>
<plugins>
<add name="DiskCache" />
<add name="PrettyGifs" />
</plugins>
</resizer>
</configuration>