• Articles
  • API Documentation
Search Results for

    Show / Hide Table of Contents
    • SixLabors.ImageSharp.Web
      • CaseHandlingUriBuilder
      • CaseHandlingUriBuilder.CaseHandling
      • CommandHandling
      • ExifOrientationUtilities
      • Format
      • FormatCommand
      • FormatUtilities
      • FormattedImage
      • HMACUtilities
      • ImageCacheMetadata
      • ImageMetadata
      • RequestAuthorizationUtilities
      • Resampler
      • ResamplerCommand
    • SixLabors.ImageSharp.Web.Caching
      • ICacheHash
      • ICacheKey
      • IImageCache
      • LegacyV1CacheKey
      • PhysicalFileSystemCache
      • PhysicalFileSystemCacheOptions
      • SHA256CacheHash
      • UriAbsoluteCacheKey
      • UriAbsoluteLowerInvariantCacheKey
      • UriRelativeCacheKey
      • UriRelativeLowerInvariantCacheKey
    • SixLabors.ImageSharp.Web.Commands
      • CommandCollection
      • CommandCollectionExtensions
      • CommandParser
      • IRequestParser
      • PresetOnlyQueryCollectionRequestParser
      • PresetOnlyQueryCollectionRequestParserOptions
      • QueryCollectionRequestParser
    • SixLabors.ImageSharp.Web.Commands.Converters
      • ArrayConverter<T>
      • ColorConverter
      • EnumConverter
      • ICommandConverter
      • ICommandConverter<T>
      • IntegralNumberConverter<T>
      • ListConverter<T>
      • SimpleCommandConverter<T>
    • SixLabors.ImageSharp.Web.DependencyInjection
      • ApplicationBuilderExtensions
      • IImageSharpBuilder
      • ImageSharpBuilderExtensions
      • ServiceCollectionExtensions
    • SixLabors.ImageSharp.Web.Middleware
      • ImageCommandContext
      • ImageProcessingContext
      • ImageSharpMiddleware
      • ImageSharpMiddlewareOptions
    • SixLabors.ImageSharp.Web.Processors
      • AutoOrientWebProcessor
      • BackgroundColorWebProcessor
      • FormatWebProcessor
      • IImageWebProcessor
      • QualityWebProcessor
      • ResizeWebProcessor
    • SixLabors.ImageSharp.Web.Providers
      • FileProviderImageProvider
      • IImageProvider
      • PhysicalFileSystemProvider
      • PhysicalFileSystemProviderOptions
      • ProcessingBehavior
      • WebRootImageProvider
    • SixLabors.ImageSharp.Web.Resolvers
      • FileProviderImageResolver
      • IImageCacheResolver
      • IImageResolver
      • PhysicalFileSystemCacheResolver
    • SixLabors.ImageSharp.Web.Synchronization
      • AsyncKeyLock<TKey>
      • AsyncKeyReaderWriterLock<TKey>
      • AsyncLock
      • AsyncReaderWriterLock
      • RefCountedConcurrentDictionary<TKey, TValue>
    • SixLabors.ImageSharp.Web.TagHelpers
      • HmacTokenTagHelper
      • ImageTagHelper

    Class ImageTagHelper

    A TagHelper implementation targeting <img> element that allows the automatic generation image processing commands.

    Inheritance
    object
    TagHelper
    UrlResolutionTagHelper
    ImageTagHelper
    Implements
    ITagHelper
    ITagHelperComponent
    Inherited Members
    UrlResolutionTagHelper.ProcessUrlAttribute(string, TagHelperOutput)
    UrlResolutionTagHelper.TryResolveUrl(string, out string)
    UrlResolutionTagHelper.TryResolveUrl(string, out IHtmlContent)
    UrlResolutionTagHelper.UrlHelperFactory
    UrlResolutionTagHelper.HtmlEncoder
    UrlResolutionTagHelper.ViewContext
    TagHelper.Init(TagHelperContext)
    TagHelper.ProcessAsync(TagHelperContext, TagHelperOutput)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: SixLabors.ImageSharp.Web.TagHelpers
    Assembly: SixLabors.ImageSharp.Web.dll
    Syntax
    [HtmlTargetElement("img", Attributes = "src,imagesharp-width", TagStructure = TagStructure.WithoutEndTag)]
    [HtmlTargetElement("img", Attributes = "src,imagesharp-height", TagStructure = TagStructure.WithoutEndTag)]
    [HtmlTargetElement("img", Attributes = "src,imagesharp-ranchor", TagStructure = TagStructure.WithoutEndTag)]
    [HtmlTargetElement("img", Attributes = "src,imagesharp-rmode", TagStructure = TagStructure.WithoutEndTag)]
    [HtmlTargetElement("img", Attributes = "src,imagesharp-rxy", TagStructure = TagStructure.WithoutEndTag)]
    [HtmlTargetElement("img", Attributes = "src,imagesharp-rcolor", TagStructure = TagStructure.WithoutEndTag)]
    [HtmlTargetElement("img", Attributes = "src,imagesharp-compand", TagStructure = TagStructure.WithoutEndTag)]
    [HtmlTargetElement("img", Attributes = "src,imagesharp-orient", TagStructure = TagStructure.WithoutEndTag)]
    [HtmlTargetElement("img", Attributes = "src,imagesharp-autoorient", TagStructure = TagStructure.WithoutEndTag)]
    [HtmlTargetElement("img", Attributes = "src,imagesharp-format", TagStructure = TagStructure.WithoutEndTag)]
    [HtmlTargetElement("img", Attributes = "src,imagesharp-bgcolor", TagStructure = TagStructure.WithoutEndTag)]
    [HtmlTargetElement("img", Attributes = "src,imagesharp-quality", TagStructure = TagStructure.WithoutEndTag)]
    public class ImageTagHelper : UrlResolutionTagHelper, ITagHelper, ITagHelperComponent

    Constructors

    | Edit this page View Source

    ImageTagHelper(IOptions<ImageSharpMiddlewareOptions>, RequestAuthorizationUtilities, IUrlHelperFactory, HtmlEncoder)

    Initializes a new instance of the ImageTagHelper class.

    Declaration
    public ImageTagHelper(IOptions<ImageSharpMiddlewareOptions> options, RequestAuthorizationUtilities authorizationUtilities, IUrlHelperFactory urlHelperFactory, HtmlEncoder htmlEncoder)
    Parameters
    Type Name Description
    IOptions<ImageSharpMiddlewareOptions> options

    The middleware configuration options.

    RequestAuthorizationUtilities authorizationUtilities

    Contains helpers that allow authorization of image requests.

    IUrlHelperFactory urlHelperFactory

    The URL helper factory.

    HtmlEncoder htmlEncoder

    The HTML encorder.

    Properties

    | Edit this page View Source

    AnchorPosition

    Gets or sets the anchor position.

    Declaration
    [HtmlAttributeName("imagesharp-ranchor")]
    public AnchorPositionMode? AnchorPosition { get; set; }
    Property Value
    Type Description
    AnchorPositionMode?
    | Edit this page View Source

    AutoOrient

    Gets or sets a value indicating whether to automatically rotate/flip the input image based on embedded EXIF orientation property values before processing.

    Declaration
    [HtmlAttributeName("imagesharp-autoorient")]
    public bool? AutoOrient { get; set; }
    Property Value
    Type Description
    bool?
    | Edit this page View Source

    BackgroundColor

    Gets or sets the background color of the image.

    Declaration
    [HtmlAttributeName("imagesharp-bgcolor")]
    public Color? BackgroundColor { get; set; }
    Property Value
    Type Description
    Color?
    | Edit this page View Source

    Center

    Gets or sets the center coordinates.

    Declaration
    [HtmlAttributeName("imagesharp-rxy")]
    public PointF? Center { get; set; }
    Property Value
    Type Description
    PointF?
    | Edit this page View Source

    Compand

    Gets or sets a value indicating whether to compress or expand individual pixel colors values on processing.

    Declaration
    [HtmlAttributeName("imagesharp-compand")]
    public bool? Compand { get; set; }
    Property Value
    Type Description
    bool?
    | Edit this page View Source

    Format

    Gets or sets the image format to convert to.

    Declaration
    [HtmlAttributeName("imagesharp-format")]
    public FormatCommand? Format { get; set; }
    Property Value
    Type Description
    FormatCommand?
    | Edit this page View Source

    Height

    Gets or sets the height in pixel units.

    Declaration
    [HtmlAttributeName("imagesharp-height")]
    public int? Height { get; set; }
    Property Value
    Type Description
    int?
    Remarks

    Passed through to the generated HTML in all cases.

    | Edit this page View Source

    Order

    When a set of ITagHelpers are executed, their Init(TagHelperContext)'s are first invoked in the specified Order; then their ProcessAsync(TagHelperContext, TagHelperOutput)'s are invoked in the specified Order. Lower values are executed first.

    Declaration
    public override int Order { get; }
    Property Value
    Type Description
    int
    Overrides
    UrlResolutionTagHelper.Order
    Remarks

    Default order is 0.

    | Edit this page View Source

    Orient

    Gets or sets a value indicating whether to factor embedded EXIF orientation property values during processing.

    Declaration
    [HtmlAttributeName("imagesharp-orient")]
    public bool? Orient { get; set; }
    Property Value
    Type Description
    bool?
    Remarks

    Defaults to true.

    | Edit this page View Source

    PadColor

    Gets or sets the color to use as a background when padding an image.

    Declaration
    [HtmlAttributeName("imagesharp-rcolor")]
    public Color? PadColor { get; set; }
    Property Value
    Type Description
    Color?
    | Edit this page View Source

    Quality

    Gets or sets the quality, that will be used to encode the image. Quality index must be between 0 and 100 (compression from max to min).

    Declaration
    [HtmlAttributeName("imagesharp-quality")]
    public int? Quality { get; set; }
    Property Value
    Type Description
    int?
    | Edit this page View Source

    ResizeMode

    Gets or sets the resize mode.

    Declaration
    [HtmlAttributeName("imagesharp-rmode")]
    public ResizeMode? ResizeMode { get; set; }
    Property Value
    Type Description
    ResizeMode?
    | Edit this page View Source

    Sampler

    Gets or sets the sampling algorithm to use when resizing images.

    Declaration
    [HtmlAttributeName("imagesharp-rsampler")]
    public ResamplerCommand? Sampler { get; set; }
    Property Value
    Type Description
    ResamplerCommand?
    | Edit this page View Source

    Src

    Gets or sets the src.

    Declaration
    [HtmlAttributeName("src")]
    public string? Src { get; set; }
    Property Value
    Type Description
    string
    Remarks

    Passed through to the generated HTML in all cases.

    | Edit this page View Source

    Width

    Gets or sets the width in pixel units.

    Declaration
    [HtmlAttributeName("imagesharp-width")]
    public int? Width { get; set; }
    Property Value
    Type Description
    int?
    Remarks

    Passed through to the generated HTML in all cases.

    Methods

    | Edit this page View Source

    AddProcessingCommands(TagHelperContext, TagHelperOutput, CommandCollection, CultureInfo)

    Allows the addition of processing commands by inheriting classes.

    Declaration
    protected virtual void AddProcessingCommands(TagHelperContext context, TagHelperOutput output, CommandCollection commands, CultureInfo commandCulture)
    Parameters
    Type Name Description
    TagHelperContext context

    Contains information associated with the current HTML tag.

    TagHelperOutput output

    A stateful HTML element used to generate an HTML tag.

    CommandCollection commands

    The command collection.

    CultureInfo commandCulture

    The culture to use when generating and processing commands.

    | Edit this page View Source

    Process(TagHelperContext, TagHelperOutput)

    Synchronously executes the TagHelper with the given context and output.

    Declaration
    public override void Process(TagHelperContext context, TagHelperOutput output)
    Parameters
    Type Name Description
    TagHelperContext context

    Contains information associated with the current HTML tag.

    TagHelperOutput output

    A stateful HTML element used to generate an HTML tag.

    Overrides
    UrlResolutionTagHelper.Process(TagHelperContext, TagHelperOutput)

    Implements

    ITagHelper
    ITagHelperComponent
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX