ImageTagHelper Class

Definition

ITagHelper implementation targeting <img> elements that supports file versioning.

public ref class ImageTagHelper : Microsoft::AspNetCore::Mvc::Razor::TagHelpers::UrlResolutionTagHelper
[Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElement("img", Attributes="asp-append-version,src", TagStructure=Microsoft.AspNetCore.Razor.TagHelpers.TagStructure.WithoutEndTag)]
public class ImageTagHelper : Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper
[<Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElement("img", Attributes="asp-append-version,src", TagStructure=Microsoft.AspNetCore.Razor.TagHelpers.TagStructure.WithoutEndTag)>]
type ImageTagHelper = class
    inherit UrlResolutionTagHelper
Public Class ImageTagHelper
Inherits UrlResolutionTagHelper
Inheritance
Attributes

Remarks

The tag helper won't process for cases with just the 'src' attribute.

Constructors

ImageTagHelper(IFileVersionProvider, HtmlEncoder, IUrlHelperFactory)

Creates a new ImageTagHelper.

ImageTagHelper(IHostingEnvironment, IMemoryCache, HtmlEncoder, IUrlHelperFactory)
Obsolete.

Creates a new ImageTagHelper.

ImageTagHelper(IHostingEnvironment, TagHelperMemoryCacheProvider, IFileVersionProvider, HtmlEncoder, IUrlHelperFactory)

Creates a new ImageTagHelper.

ImageTagHelper(IWebHostEnvironment, TagHelperMemoryCacheProvider, IFileVersionProvider, HtmlEncoder, IUrlHelperFactory)
Obsolete.

Creates a new ImageTagHelper. This constructor is obsolete and will be removed in a future version.

Properties

AppendVersion

Value indicating if file version should be appended to the src urls.

Cache
Obsolete.

Gets the IMemoryCache used to store globbed urls. This property is obsolete and will be removed in a future version.

HostingEnvironment
Obsolete.

Gets the IWebHostEnvironment for the application. This property is obsolete and will be removed in a future version.

HtmlEncoder

The HtmlEncoder.

(Inherited from UrlResolutionTagHelper)
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.

Src

Source of the image.

UrlHelperFactory

The IUrlHelperFactory.

(Inherited from UrlResolutionTagHelper)
ViewContext

The ViewContext.

(Inherited from UrlResolutionTagHelper)

Methods

Init(TagHelperContext)

Initializes the ITagHelper with the given context. Additions to Items should be done within this method to ensure they're added prior to executing the children.

(Inherited from TagHelper)
Process(TagHelperContext, TagHelperOutput)

Synchronously executes the TagHelper with the given context and output.

ProcessAsync(TagHelperContext, TagHelperOutput)

Asynchronously executes the TagHelper with the given context and output.

(Inherited from TagHelper)
ProcessUrlAttribute(String, TagHelperOutput)

Resolves and updates URL values starting with '~/' (relative to the application's 'webroot' setting) for output's Attributes whose Name is attributeName.

(Inherited from UrlResolutionTagHelper)
TryResolveUrl(String, IHtmlContent)

Tries to resolve the given url value relative to the application's 'webroot' setting.

(Inherited from UrlResolutionTagHelper)
TryResolveUrl(String, String)

Tries to resolve the given url value relative to the application's 'webroot' setting.

(Inherited from UrlResolutionTagHelper)

Applies to