Class ImageResult
An IActionResult implementation that returns an image file as response, optionally resized and cached for a client.
Implements
Inherited Members
Namespace: DataWeb.ActionResults
Assembly: DataWeb.Core.dll
Syntax
public sealed class ImageResult : IActionResult
Remarks
Initializes a new instance of the ImageResult class.
Constructors
ImageResult(IImageService, IFile, int, int, ResizeMode, int, bool, bool, bool, string, Func<object, Task>)
An IActionResult implementation that returns an image file as response, optionally resized and cached for a client.
Declaration
public ImageResult(IImageService imageService, IFile file, int width, int height, ResizeMode resizeMode, int cacheSeconds = 30758400, bool isMetaDataRemoval = false, bool isCutDisabled = false, bool isOriginalFormat = false, string imageContext = null, Func<object, Task> imageProcessDelegate = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IImageService | imageService | The image service responsible for processing the image. |
| IFile | file | The image file to be processed. |
| int | width | The width to resize the image to. |
| int | height | The height to resize the image to. |
| ResizeMode | resizeMode | The mode used to resize the image. |
| int | cacheSeconds | The duration, in seconds, for which the image should be cached. Defaults to one year. |
| bool | isMetaDataRemoval | |
| bool | isCutDisabled | |
| bool | isOriginalFormat | |
| string | imageContext | |
| Func<object, Task> | imageProcessDelegate |
Remarks
Initializes a new instance of the ImageResult class.
Methods
ExecuteResultAsync(ActionContext)
Generates the HTTP response with the image data.
Declaration
public Task ExecuteResultAsync(ActionContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| ActionContext | context | The ActionContext for the current request. |
Returns
| Type | Description |
|---|---|
| Task | A Task that completes when the result has been executed. |