Table of Contents

RazorPageExtensions.ImageTag Method

Definition

Namespace
GleamTech.ImageUltimate.AspNet.Core
Assembly
GleamTech.ImageUltimate.dll

ImageTag(RazorPageBase, string, Action<ImageWebTask>)

Returns an image element with a unique and browser-cacheable url for the processed image. The first time this method is called, the image will be processed and cached on the server. The url will vary according to the processing commands so browser cache will be updated automatically when you change the parameters.

public static HtmlString ImageTag(this RazorPageBase razorPage, string imagePath, Action<ImageWebTask> action)

Parameters

razorPage RazorPageBase

The Microsoft.AspNetCore.Mvc.Razor.RazorPageBase instance.

imagePath string

The virtual or physical path to the image to process. If a plain file name (eg. Picture.jpg) or a non-rooted path (eg. SomeFolder/Picture.jpg) is given, it will considered relative to the default source path set by SourcePath. If the given path is rooted (eg ~/Picture.jpg, /SomeFolder/Picture.jpg or C:\SomeFolder\Picture.jpg), the exact path will be used, ie. the default source path will be ignored.

action Action<ImageWebTask>

The method for processing the image. This is usually a lambda expression which chains image processing commands.

Returns

HtmlString

The image element.

ImageTag(RazorPageBase, string, Action<ImageWebTask>, object)

Returns an image element with a unique and browser-cacheable url for the processed image. The first time this method is called, the image will be processed and cached on the server. The url will vary according to the processing commands so browser cache will be updated automatically when you change the parameters.

public static HtmlString ImageTag(this RazorPageBase razorPage, string imagePath, Action<ImageWebTask> action, object htmlAttributes)

Parameters

razorPage RazorPageBase

The Microsoft.AspNetCore.Mvc.Razor.RazorPageBase instance.

imagePath string

The virtual or physical path to the image to process. If a plain file name (eg. Picture.jpg) or a non-rooted path (eg. SomeFolder/Picture.jpg) is given, it will considered relative to the default source path set by SourcePath. If the given path is rooted (eg ~/Picture.jpg, /SomeFolder/Picture.jpg or C:\SomeFolder\Picture.jpg), the exact path will be used, ie. the default source path will be ignored.

action Action<ImageWebTask>

The method for processing the image. This is usually a lambda expression which chains image processing commands.

htmlAttributes object

An object that contains the HTML attributes to set for the element.

Returns

HtmlString

The image element.