If you want to use customized storage such as DB or Distributed File System, this page may help you.

By default, Image server supports two types of storage:
  • File System
  • MongoDB GridFS

To use other storage, you need to:
  1. Implement ImageServer.Common.IImageLoader :
Image Load(string filename);
This method will load the file with specified filename into a System.Drawing.Image instant.

byte[] Open(ref string filename);
This method will load the file into a byte array and correct the filename, so that the source picture file can be cached and output.
  1. Implement ImageServer.Common.IFilenameGetter
string GetFilename(HttpContext context);
This method will get a filename from current http context, and the default FilenameGetter is "ImageServer.Common.DefaultFilenameGetter" which use the parameter "p" in query string as filename.

  1. Configurate the appSettings node of web.config, set the type name of your ImageLoader and FilenameGetter
  <add key="IImageLoader" value="ImageLoaders.GridFSImageLoader, ImageLoaders" />
  <add key="IFilenameGetter" value="ImageServer.Common.DefaultFilenameGetter, ImageServer.Lib" />

Last edited Aug 28, 2012 at 6:10 AM by lchrennew, version 1

Comments

No comments yet.