.net Image Resize

来源:互联网 发布:淘宝外国模特 编辑:程序博客网 时间:2024/06/06 02:09

nuget install ImageResizer.Plugins.DiskCache   3.4.3


nuget upgrade ImageResizer.dll to  3.4.3


nuget install ImageResizer.Plugins.SimpleFilters


Web Config

<?xml version="1.0" encoding="utf-8"?>

<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <configSections>
    <section name="resizer" type="ImageResizer.ResizerSection,ImageResizer" requirePermission="false" />
  </configSections>

  <system.web>
    <compilation debug="true" targetFramework="4.5.2" />
    <httpRuntime targetFramework="4.5.2" />
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules>
      <!-- This is for IIS7+ Integrated mode -->
      <add name="ImageResizingModule" type="ImageResizer.InterceptModule" />
    </modules>
  </system.webServer>

  <resizer>
    <plugins>
      <add name="DiskCache" />
      <!-- Add Presets plugin (v3.1+) -->
      <!-- http://www.imageresizing.net/plugins/presets -->
      <add name="Presets" />
    <add name="SimpleFilters" /></plugins>
    <presets onlyAllowPresets="false">
      <preset name="S" defaults="width=200;height=200;mode=crop;format=jpg;quality=70;anchor=middlecenter;scale=both" />
      <preset name="M" defaults="width=400;height=400;mode=crop;format=jpg;quality=65;anchor=middlecenter;scale=both" />
      <preset name="L" defaults="width=800;height=800;mode=crop;format=jpg;quality=60;anchor=middlecenter;scale=both" />
    </presets>
    <!-- See http://www.imageresizing.net/plugins/diskcache for details. Avoid changing these settings -->
    <diskCache dir="~/imagecache" autoClean="false" hashModifiedDate="true" enabled="true" subfolders="32" cacheAccessTimeout="15000" />
  </resizer>

</configuration>


访问图片 

?preset=l

?preset=s&s.grayscale=true

0 0