Allows files stored on MongoDB GridFS to be resized and processed as if they were local.
You can access files by their ID (best) or their filename (if it is URL-safe).
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 name="MongoReader" connectionString="mongodb://user:[email protected]/database" />inside
You must specify a valid connection string that includes both the database name and credentials.
- connectionString - A valid MongoDB connection string.
checkForModifiedFiles="false") - Causes the modified date of the source file to be retreived. If the modified date has changed, the image will be re-downloaded and re-processed. Affects performance, as it causes a roundtrip to occur even when an image is cached. Metadata caching can minimize the request count.
lazyExistenceCheck="true") - If false (the default), does not check for the existence of a file until .Open() is called. Reduces network roundtrips.
cacheMetadata="true") - Enables metadata caching to minimize roundtrips (defaults to true).
IMetadataCache .MetadataCache- The metadata cache to use. Defaults to StandardMetadataCache, which caches metadata for up to an hour after it was last accessed or used (sliding expiration).
vpp="true") - Exposes the blobs via a VirtualPathProvider, so that they can be served (when unmodified) by StaticFileHandler. Otherwise, unmodified blobs may be inaccessible.
string .VirtualFilesystemPrefix(XML: `prefix="~/vpp") - The virtual subfolder within which the blobs will be accessible.
requireImageExtension="true") - If false, the blob provider will cause non-image requests to be processed by ImageResizer. Always use a file extension if possible, as otherwise the wrong content-type may served by IIS. If true,
prefixmay NOT overlap with any other routes or locations, as ImageResizer will be intercepting all requests within the specified virtual path.
untrustedData="false") - If true, all images will be re-encoded before being served to the client. Invalid or malicious images will fail with an error if they cannot be read as images. This should prevent malicious files from being served to the client.
cacheUnmodifiedFiles="false") - If true, unmodified requests will be cached by ImageResizer (if DiskCache is installed). This can be useful if unmodified files are relatively small and the backend storage is latent.
This plugin inherits most of its functionality from BlobProviderBase, which you can use to create your own provider.
This plugin (MongoReader plugin) is part of the Elite Edition
Where is the plugins section?
<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.