Install ImageResizer

First, some questions.

  1. Are you using the URL API?
  2. Are you using the managed or COM API?

 

If you answered "no" to #1 and "yes" to #2, see our non-web installation guide. Console, WPF, WCF, WinForms, and Classic ASP users sometimes choose to only use the Managed API.

If you answered "yes" to #1, and "no" to #2, you might consider using ImageResizer as a standalone image server. PHP, Ruby, and Python users might consider this, as well as users with dozens of terabytes of images.

Note: If you want to modify Web.config yourself, substitute ImageResizer.Mvc for ImageResizer.MvcWebConfig below. MvcWebConfig will only add - never delete - elements in Web.config.

via the NuGet Package Manager Console (option 1)

Open the nuget console from Visual Studio via Tools > Library Package Manager > Package Manager Console.

PM> Install-Package ImageResizer.MvcWebConfig
PM> Install-Package ImageResizer.Plugins.DiskCache
PM> Install-Package ImageResizer.Plugins.PrettyGifs
PM> Install-Package ImageResizer.Plugins.SimpleFilters

via the NuGet GUI (Visual Studio) (option 2)

  1. Right-click on your project and click "Manage NuGet Packages".
  2. Select "NuGet Official Package Source"
  3. Search for "Imazen", using the search bar at the top right
  4. Select "ImageResizer Web.config Installation (with MVC support)" and choose Install
  5. Repeat for each desired plugin. All plugins can be safely combined
  6. Check the documentation for each plugin to see if additional steps are required to activate the plugin. Only some NuGet packages auto-activate the included plugin(s).

View available packages on NuGet

Manual Installation (option 3)

  1. Download and unzip the package. Add ImageResizer.dll, ImageResizer.Mvc.dll, ImageResizer.Plugins.DiskCache.dll, and any other plugin dlls you wish to use to the /bin folder of the website. If you're using Visual Studio, right click your project and choose "Add Reference" for each of these files instead.

  2. Modify or create the /Web.Config file for your site. Make sure all these elements are added correctly (You may wish to make a backup of Web.config first).

     <?xml version="1.0" encoding="utf-8" ?>
     <configuration>
       <configSections>
         <section name="resizer" type="ImageResizer.ResizerSection,ImageResizer"  requirePermission="false"  />
       </configSections>
    
       <resizer>
         <!-- Unless you (a) use Integrated mode, or (b) map all requests to ASP.NET, 
              you'll need to add .ashx to your image URLs: image.jpg.ashx?width=200&height=20 -->
         <pipeline fakeExtensions=".ashx" />
    
         <plugins>
           <add name="MvcRoutingShim" />
           <add name="DiskCache" />
           <!-- <add name="PrettyGifs" /> -->
           <!-- <add name="SimpleFilters" /> -->
           <!-- <add name="S3Reader" /> -->
         </plugins>  
       </resizer>
    
       <system.web>
         <httpModules>
           <!-- This is for IIS5, IIS6, and IIS7 Classic, and Cassini/VS Web Server-->
           <add name="ImageResizingModule" type="ImageResizer.InterceptModule"/>
         </httpModules>
       </system.web>
    
       <system.webServer>
         <validation validateIntegratedModeConfiguration="false"/>
         <modules>
           <!-- This is for IIS7+ Integrated mode -->
           <add name="ImageResizingModule" type="ImageResizer.InterceptModule"/>
         </modules>
       </system.webServer>
     </configuration>
    
  3. Start your web site, then visit /resizer.debug.ashx to verify you've done everything correctly. If you ever encounter issues, simply revisit that page to access the self-diagnostics. If you need help, just ask!

Ready to go live?

  1. Review the Best Practices Guide and our license options.

  2. Get an ImageResizer license, which includes disk caching and dozens of other valuable plugins.

  3. Take a look at client-side components like Slimmage.js, which can make responsive images painless. There are many third-party libraries that can make integration easier.

  4. Join the community on Github and on StackOverflow.