Class ImageSharpMiddlewareOptions
Configuration options for the ImageSharpMiddleware middleware.
Inherited Members
Namespace: SixLabors.ImageSharp.Web.Middleware
Assembly: SixLabors.ImageSharp.Web.dll
Syntax
public class ImageSharpMiddlewareOptions
Properties
| Improve this Doc View SourceBrowserMaxAge
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.
Declaration
public TimeSpan BrowserMaxAge { get; set; }
Property Value
Type | Description |
---|---|
TimeSpan |
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.
Declaration
public uint CacheHashLength { get; set; }
Property Value
Type | Description |
---|---|
UInt32 |
CacheMaxAge
Gets or sets the duration to store images in the image cache.
Defaults to 365 days.
Declaration
public TimeSpan CacheMaxAge { get; set; }
Property Value
Type | Description |
---|---|
TimeSpan |
Configuration
Gets or sets the base library configuration.
Declaration
public Configuration Configuration { get; set; }
Property Value
Type | Description |
---|---|
Configuration |
HMACSecretKey
Gets or sets the secret key for Hash-based Message Authentication Code (HMAC) encryption.
Declaration
public byte[] HMACSecretKey { get; set; }
Property Value
Type | Description |
---|---|
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.
Declaration
public RecyclableMemoryStreamManager MemoryStreamManager { get; set; }
Property Value
Type | Description |
---|---|
RecyclableMemoryStreamManager |
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.
Declaration
public Func<FormattedImage, Task> OnBeforeSaveAsync { get; set; }
Property Value
Type | Description |
---|---|
Func<FormattedImage, Task> |
OnComputeHMACAsync
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(CaseHandlingUriBuilder.CaseHandling, PathString, PathString, QueryString).
Declaration
public Func<ImageCommandContext, byte[], Task<string>> OnComputeHMACAsync { get; set; }
Property Value
Type | Description |
---|---|
Func<ImageCommandContext, Byte[], Task<String>> |
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.
Declaration
public Func<ImageCommandContext, Task> OnParseCommandsAsync { get; set; }
Property Value
Type | Description |
---|---|
Func<ImageCommandContext, Task> |
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.
Declaration
public Func<HttpContext, Task> OnPrepareResponseAsync { get; set; }
Property Value
Type | Description |
---|---|
Func<HttpContext, Task> |
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.
Declaration
public Func<ImageProcessingContext, Task> OnProcessedAsync { get; set; }
Property Value
Type | Description |
---|---|
Func<ImageProcessingContext, Task> |
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.
Declaration
public bool UseInvariantParsingCulture { get; set; }
Property Value
Type | Description |
---|---|
Boolean |