Allows files stored on MongoDB GridFS to be resized and processed as if they were local.
Requires .NET 3.5.
In version 3.1.5, you will need to build ImageResizer.Plugins.MongoReader.csproj yourself, as precompiled binaries and nuget packages won't be included until V3.2
This plugin is alpha, but supported.
Example URLs
You can access files by their ID (best) or their filename (if it is URL-safe).
- http://localhost/gridfs/filename.jpg?width=100
- http://localhost/gridfs/folder/filename.jpg?width=100
- http://localhost/gridfs/id/4f44195642f73910f056eb33.jpg?width=200
Installation
Either run Install-Package ImageResizer.Plugins.MongoReader
in the NuGet package manager, or:
- Add ImageResizer.Plugins.MongoReader.dll to your project (MongoDB.Driver.dll and MongoDB.BSON.dll will automatically be copied)
- Add
<add name="MongoReader" connectionString="mongodb://user:password@servername/database" />
inside<plugins></plugins>
in Web.config.
Configuration
You must specify a valid connection string that includes both the database name and credentials.
- prefix - the virtual folder mapped to the specified database. Defaults to 'gridfs'
- connectionString - A valid MongoDB connection string.
This plugin (MongoReader plugin) is part of the Elite Edition
Where is the plugins section?
The <plugins>
section is located in Web.config, and is nested inside the <resizer>
element, which is nested inside <configuration>
. For examples, see this sample Web.config file.
Where can I find the dll?
We prefer that you install via NuGet, but you can also find the plugin DLL files in the /dlls/release folder of your download.
How do I typically install a plugin via Web.Config?
- In Visual Studio, right click on your project and choose "Add reference". Browse to the plugin DLL and click "OK".
- In the <plugins> section of Web.config, insert <add name="PluginName" />
- Look at the plugin documentation to see what configuration options (if any) are available.