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
Handles HTTP caching via Cache-Control: max-age and Last-Modified headers.
The response returns a 200 OK with image data or 304 Not Modified if the client's cached version is still valid.
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 = 31536000, 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 and retrieving the image. |
| IFile | file | The image file to be processed and returned. |
| int | width | The desired width for the resized image, in pixels. |
| int | height | The desired height for the resized image, in pixels. |
| ResizeMode | resizeMode | The ResizeMode algorithm to apply when resizing. |
| int | cacheSeconds | The duration, in seconds, for client-side caching via |
| bool | isMetaDataRemoval | If |
| bool | isCutDisabled | If |
| bool | isOriginalFormat | If |
| string | imageContext | Optional context identifier to differentiate cached thumbnail variants of the same image. |
| Func<object, Task> | imageProcessDelegate | Optional custom processing delegate to apply to the image during thumbnail generation. |
Remarks
Handles HTTP caching via Cache-Control: max-age and Last-Modified headers.
The response returns a 200 OK with image data or 304 Not Modified if the client's cached version is still valid.
Methods
ExecuteResultAsync(ActionContext)
Declaration
public Task ExecuteResultAsync(ActionContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| ActionContext | context |
Returns
| Type | Description |
|---|---|
| Task |