Table of Contents

Class FriendlyImageCropperTemplateExtensions

Namespace
Umbraco.Extensions
Assembly
Umbraco.Web.Common.dll
public static class FriendlyImageCropperTemplateExtensions
Inheritance
FriendlyImageCropperTemplateExtensions
Inherited Members

Methods

GetCropUrl(string, int?, int?, string?, string?, int?, ImageCropMode??, ImageCropAnchor??, bool, bool, string?, string?)

Gets the underlying image processing service URL from the image path.

public static string? GetCropUrl(this string imageUrl, int? width = null, int? height = null, string? imageCropperValue = null, string? cropAlias = null, int? quality = null, ImageCropMode?? imageCropMode = null, ImageCropAnchor?? imageCropAnchor = null, bool preferFocalPoint = false, bool useCropDimensions = false, string? cacheBusterValue = null, string? furtherOptions = null)

Parameters

imageUrl string

The image URL.

width int?

The width of the output image.

height int?

The height of the output image.

imageCropperValue string

The JSON data from the Umbraco Core Image Cropper property editor.

cropAlias string

The crop alias.

quality int?

Quality percentage of the output image.

imageCropMode ImageCropMode?

The image crop mode.

imageCropAnchor ImageCropAnchor?

The image crop anchor.

preferFocalPoint bool

Use focal point to generate an output image using the focal point instead of the predefined crop if there is one.

useCropDimensions bool

Use crop dimensions to have the output image sized according to the predefined crop sizes, this will override the width and height parameters.

cacheBusterValue string

Add a serialized date of the last edit of the item to ensure client cache refresh when updated.

furtherOptions string
These are any query string parameters (formatted as query strings) that the underlying image processing service
supports. For example:
<example>

furtherOptions: "bgcolor=fff"

Returns

string

The URL of the cropped image.

GetCropUrl(string, ImageCropperValue, int?, int?, string?, int?, ImageCropMode??, ImageCropAnchor??, bool, bool, string?, string?)

Gets the underlying image processing service URL from the image path.

public static string? GetCropUrl(this string imageUrl, ImageCropperValue cropDataSet, int? width = null, int? height = null, string? cropAlias = null, int? quality = null, ImageCropMode?? imageCropMode = null, ImageCropAnchor?? imageCropAnchor = null, bool preferFocalPoint = false, bool useCropDimensions = false, string? cacheBusterValue = null, string? furtherOptions = null)

Parameters

imageUrl string

The image URL.

cropDataSet ImageCropperValue

The crop data set.

width int?

The width of the output image.

height int?

The height of the output image.

cropAlias string

The crop alias.

quality int?

Quality percentage of the output image.

imageCropMode ImageCropMode?

The image crop mode.

imageCropAnchor ImageCropAnchor?

The image crop anchor.

preferFocalPoint bool

Use focal point to generate an output image using the focal point instead of the predefined crop if there is one.

useCropDimensions bool

Use crop dimensions to have the output image sized according to the predefined crop sizes, this will override the width and height parameters.

cacheBusterValue string

Add a serialized date of the last edit of the item to ensure client cache refresh when updated.

furtherOptions string
These are any query string parameters (formatted as query strings) that the underlying image processing service
supports. For example:
<example>

furtherOptions: "bgcolor=fff"

Returns

string

The URL of the cropped image.

GetCropUrl(MediaWithCrops, int?, int?, string, string?, int?, ImageCropMode??, ImageCropAnchor??, bool, bool, bool, string?, UrlMode?)

Gets the underlying image processing service URL from the MediaWithCrops item.

public static string? GetCropUrl(this MediaWithCrops mediaWithCrops, int? width = null, int? height = null, string propertyAlias = "umbracoFile", string? cropAlias = null, int? quality = null, ImageCropMode?? imageCropMode = null, ImageCropAnchor?? imageCropAnchor = null, bool preferFocalPoint = false, bool useCropDimensions = false, bool cacheBuster = true, string? furtherOptions = null, UrlMode? urlMode = 0)

Parameters

mediaWithCrops MediaWithCrops

The MediaWithCrops item.

width int?

The width of the output image.

height int?

The height of the output image.

propertyAlias string

Property alias of the property containing the JSON data.

cropAlias string

The crop alias.

quality int?

Quality percentage of the output image.

imageCropMode ImageCropMode?

The image crop mode.

imageCropAnchor ImageCropAnchor?

The image crop anchor.

preferFocalPoint bool

Use focal point, to generate an output image using the focal point instead of the predefined crop.

useCropDimensions bool

Use crop dimensions to have the output image sized according to the predefined crop sizes, this will override the width and height parameters.

cacheBuster bool

Add a serialized date of the last edit of the item to ensure client cache refresh when updated.

furtherOptions string
These are any query string parameters (formatted as query strings) that the underlying image processing service
supports. For example:
<example>

furtherOptions: "bgcolor=fff"

urlMode UrlMode

The url mode.

Returns

string

The URL of the cropped image.

GetCropUrl(MediaWithCrops, string, string, UrlMode)

Gets the underlying image processing service URL by the crop alias using the specified property containing the image cropper JSON data on the MediaWithCrops content item.

public static string? GetCropUrl(this MediaWithCrops mediaWithCrops, string propertyAlias, string cropAlias, UrlMode urlMode = 0)

Parameters

mediaWithCrops MediaWithCrops

The MediaWithCrops item.

propertyAlias string

The property alias of the property containing the JSON data e.g. umbracoFile.

cropAlias string

The crop alias e.g. thumbnail.

urlMode UrlMode

The url mode.

Returns

string

The URL of the cropped image.

GetCropUrl(MediaWithCrops, string, UrlMode)

Gets the underlying image processing service URL by the crop alias (from the "umbracoFile" property alias in the MediaWithCrops content item) on the MediaWithCrops item.

public static string? GetCropUrl(this MediaWithCrops mediaWithCrops, string cropAlias, UrlMode urlMode = 0)

Parameters

mediaWithCrops MediaWithCrops

The MediaWithCrops item.

cropAlias string

The crop alias e.g. thumbnail.

urlMode UrlMode

The url mode.

Returns

string

The URL of the cropped image.

GetCropUrl(IPublishedContent, int?, int?, string, string?, int?, ImageCropMode??, ImageCropAnchor??, bool, bool, bool, string?, UrlMode?)

Gets the underlying image processing service URL from the IPublishedContent item.

public static string? GetCropUrl(this IPublishedContent mediaItem, int? width = null, int? height = null, string propertyAlias = "umbracoFile", string? cropAlias = null, int? quality = null, ImageCropMode?? imageCropMode = null, ImageCropAnchor?? imageCropAnchor = null, bool preferFocalPoint = false, bool useCropDimensions = false, bool cacheBuster = true, string? furtherOptions = null, UrlMode? urlMode = 0)

Parameters

mediaItem IPublishedContent

The IPublishedContent item.

width int?

The width of the output image.

height int?

The height of the output image.

propertyAlias string

Property alias of the property containing the JSON data.

cropAlias string

The crop alias.

quality int?

Quality percentage of the output image.

imageCropMode ImageCropMode?

The image crop mode.

imageCropAnchor ImageCropAnchor?

The image crop anchor.

preferFocalPoint bool

Use focal point, to generate an output image using the focal point instead of the predefined crop.

useCropDimensions bool

Use crop dimensions to have the output image sized according to the predefined crop sizes, this will override the width and height parameters.

cacheBuster bool

Add a serialized date of the last edit of the item to ensure client cache refresh when updated.

furtherOptions string
These are any query string parameters (formatted as query strings) that the underlying image processing service
supports. For example:
<example>

furtherOptions: "bgcolor=fff"

urlMode UrlMode

The url mode.

Returns

string

The URL of the cropped image.

GetCropUrl(IPublishedContent, string, string, UrlMode)

Gets the underlying image processing service URL by the crop alias using the specified property containing the image cropper JSON data on the IPublishedContent item.

public static string? GetCropUrl(this IPublishedContent mediaItem, string propertyAlias, string cropAlias, UrlMode urlMode = 0)

Parameters

mediaItem IPublishedContent

The IPublishedContent item.

propertyAlias string

The property alias of the property containing the JSON data e.g. umbracoFile.

cropAlias string

The crop alias e.g. thumbnail.

urlMode UrlMode

The url mode.

Returns

string

The URL of the cropped image.

GetCropUrl(IPublishedContent, string, UrlMode)

Gets the underlying image processing service URL by the crop alias (from the "umbracoFile" property alias) on the IPublishedContent item.

public static string? GetCropUrl(this IPublishedContent mediaItem, string cropAlias, UrlMode urlMode = 0)

Parameters

mediaItem IPublishedContent

The IPublishedContent item.

cropAlias string

The crop alias e.g. thumbnail.

urlMode UrlMode

The url mode.

Returns

string

The URL of the cropped image.

GetCropUrl(IPublishedContent, ImageCropperValue, string, UrlMode)

Gets the crop URL by using only the specified imageCropperValue.

public static string? GetCropUrl(this IPublishedContent mediaItem, ImageCropperValue imageCropperValue, string cropAlias, UrlMode urlMode = 0)

Parameters

mediaItem IPublishedContent

The media item.

imageCropperValue ImageCropperValue

The image cropper value.

cropAlias string

The crop alias.

urlMode UrlMode

The url mode.

Returns

string

The image crop URL.