DataWeb
Search Results for

    Show / Hide Table of Contents

    Class ImageResult

    An IActionResult implementation that returns an image file as response, optionally resized and cached for a client.

    Inheritance
    object
    ImageResult
    Implements
    IActionResult
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    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 Cache-Control: max-age. Defaults to one year (31,536,000 seconds).

    bool isMetaDataRemoval

    If true, removes EXIF and metadata from the thumbnail.

    bool isCutDisabled

    If true, disables the crop operation defined in the file settings.

    bool isOriginalFormat

    If true, preserves the original file format instead of converting to WebP.

    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

    Implements

    IActionResult
    In this article
    Back to top Generated by DocFX