Class ImageSharpMiddlewareOptions
- Namespace
- SixLabors.ImageSharp.Web.Middleware
- Assembly
- SixLabors.ImageSharp.Web.dll
Configuration options for the ImageSharpMiddleware middleware.
public class ImageSharpMiddlewareOptions
- Inheritance
-
ImageSharpMiddlewareOptions
- Inherited Members
Properties
BrowserMaxAge
Gets or sets the duration to store images in the browser cache. If an image provider provides a Max-Age for a source image then that will override this value.
Defaults to 7 days.
public TimeSpan BrowserMaxAge { get; set; }
Property Value
CacheHashLength
Gets or sets the length of the filename to use (minus the extension) when storing images in the image cache. Defaults to 12 characters.
public uint CacheHashLength { get; set; }
Property Value
CacheMaxAge
Gets or sets the duration to store images in the image cache.
Defaults to 365 days.
public TimeSpan CacheMaxAge { get; set; }
Property Value
Configuration
Gets or sets the base library configuration.
public Configuration Configuration { get; set; }
Property Value
HMACSecretKey
Gets or sets the secret key for Hash-based Message Authentication Code (HMAC) encryption.
public byte[] HMACSecretKey { get; set; }
Property Value
- byte[]
Remarks
The key can be any length. However, the recommended size is at least 64 bytes. If the length is zero then no authentication is performed.
MemoryStreamManager
Gets or sets the recyclable memorystream manager used for managing pooled stream buffers independently from image buffer pooling.
public RecyclableMemoryStreamManager MemoryStreamManager { get; set; }
Property Value
- RecyclableMemoryStreamManager
OnBeforeLoadAsync
Gets or sets the method that can be used to used to augment decoder options. This is called before the image is decoded and loaded for processing.
public Func<ImageCommandContext, Configuration, Task<DecoderOptions?>> OnBeforeLoadAsync { get; set; }
Property Value
OnBeforeSaveAsync
Gets or sets the additional method that can be used for final manipulation before the image is saved. This is called after image has been processed, but before the image has been saved to the output stream for caching. This can be used to alter the metadata of the resultant image.
public Func<FormattedImage, Task> OnBeforeSaveAsync { get; set; }
Property Value
OnComputeHMAC
Gets or sets the method used to compute a Hash-based Message Authentication Code (HMAC) for request authentication. Defaults to ComputeHMACSHA256(string, byte[]) using an invariant lowercase relative Uri generated using BuildRelative(CaseHandling, PathString, PathString, QueryString).
public Func<ImageCommandContext, byte[], string> OnComputeHMAC { get; set; }
Property Value
OnParseCommandsAsync
Gets or sets the additional command parsing method that can be used to used to augment commands. This is called once the commands have been gathered and before an IImageProvider has been assigned.
public Func<ImageCommandContext, Task> OnParseCommandsAsync { get; set; }
Property Value
OnPrepareResponseAsync
Gets or sets the additional response method. This is called after the status code and headers have been set, but before the body has been written. This can be used to add or change the response headers.
public Func<HttpContext, Task> OnPrepareResponseAsync { get; set; }
Property Value
OnProcessedAsync
Gets or sets the additional processing method. This is called after image has been processed, but before the result has been cached. This can be used to further optimize the resultant image.
public Func<ImageProcessingContext, Task> OnProcessedAsync { get; set; }
Property Value
UseInvariantParsingCulture
Gets or sets a value indicating whether to use culture-independent (invariant) conversion when converting commands. If set to false the CommandParser will use the CurrentCulture.
public bool UseInvariantParsingCulture { get; set; }