ImageTagHelper ImageTagHelper ImageTagHelper Class

Definition

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

[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
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(IHostingEnvironment, IMemoryCache, HtmlEncoder, IUrlHelperFactory) ImageTagHelper(IHostingEnvironment, IMemoryCache, HtmlEncoder, IUrlHelperFactory) ImageTagHelper(IHostingEnvironment, IMemoryCache, HtmlEncoder, IUrlHelperFactory)

Creates a new ImageTagHelper.

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

Creates a new ImageTagHelper.

Properties

AppendVersion AppendVersion AppendVersion

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

Cache Cache Cache
HostingEnvironment HostingEnvironment HostingEnvironment
HtmlEncoder HtmlEncoder HtmlEncoder Inherited from UrlResolutionTagHelper
Order Order Order
Src Src Src

Source of the image.

UrlHelperFactory UrlHelperFactory UrlHelperFactory Inherited from UrlResolutionTagHelper
ViewContext ViewContext ViewContext Inherited from UrlResolutionTagHelper

Methods

Init(TagHelperContext) Init(TagHelperContext) 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) Process(TagHelperContext, TagHelperOutput) Process(TagHelperContext, TagHelperOutput)
ProcessAsync(TagHelperContext, TagHelperOutput) ProcessAsync(TagHelperContext, TagHelperOutput) ProcessAsync(TagHelperContext, TagHelperOutput)

Asynchronously executes the TagHelper with the given context and output.

(Inherited from TagHelper)
ProcessUrlAttribute(String, TagHelperOutput) ProcessUrlAttribute(String, TagHelperOutput) 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) TryResolveUrl(String, IHtmlContent) TryResolveUrl(String, IHtmlContent)

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

(Inherited from UrlResolutionTagHelper)
TryResolveUrl(String, String) TryResolveUrl(String, String) TryResolveUrl(String, String)

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

(Inherited from UrlResolutionTagHelper)

Applies to