ImageTagHelper Class

Summary

@!:ITagHelper- implementation targeting <img> elements that supports file versioning.

Syntax

public class ImageTagHelper : TagHelper

GitHub

View on GitHub

class Microsoft.AspNet.Mvc.TagHelpers.ImageTagHelper

Constructors

ImageTagHelper(IHostingEnvironment, IMemoryCache)

Creates a new [Microsoft.AspNet.Mvc.TagHelpers.ImageTagHelper](Microsoft.AspNet.Mvc.TagHelpers.ImageTagHelper.yml).

Arguments:
  • hostingEnvironment (IHostingEnvironment) – The @!:IHostingEnvironment-.
  • cache (IMemoryCache) – The @!:IMemoryCache-.
public ImageTagHelper(IHostingEnvironment hostingEnvironment, IMemoryCache cache)

Properties

AppendVersion()

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

Return type:System.Boolean
public bool AppendVersion { get; set; }
Cache()
Return type:IMemoryCache
protected IMemoryCache Cache { get; }
HostingEnvironment()
Return type:IHostingEnvironment
protected IHostingEnvironment HostingEnvironment { get; }
Src()

Source of the image.

Return type:System.String
public string Src { get; set; }
ViewContext()
Return type:Microsoft.AspNet.Mvc.ViewContext
public ViewContext ViewContext { get; set; }

Methods

Process(TagHelperContext, TagHelperOutput)
Arguments:
  • context (TagHelperContext) –
  • output (TagHelperOutput) –
public override void Process(TagHelperContext context, TagHelperOutput output)