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
stringThe image URL.
width
int?The width of the output image.
height
int?The height of the output image.
imageCropperValue
stringThe JSON data from the Umbraco Core Image Cropper property editor.
cropAlias
stringThe crop alias.
quality
int?Quality percentage of the output image.
imageCropMode
ImageCropMode?The image crop mode.
imageCropAnchor
ImageCropAnchor?The image crop anchor.
preferFocalPoint
boolUse focal point to generate an output image using the focal point instead of the predefined crop if there is one.
useCropDimensions
boolUse crop dimensions to have the output image sized according to the predefined crop sizes, this will override the width and height parameters.
cacheBusterValue
stringAdd a serialized date of the last edit of the item to ensure client cache refresh when updated.
furtherOptions
stringThese 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
stringThe image URL.
cropDataSet
ImageCropperValueThe crop data set.
width
int?The width of the output image.
height
int?The height of the output image.
cropAlias
stringThe crop alias.
quality
int?Quality percentage of the output image.
imageCropMode
ImageCropMode?The image crop mode.
imageCropAnchor
ImageCropAnchor?The image crop anchor.
preferFocalPoint
boolUse focal point to generate an output image using the focal point instead of the predefined crop if there is one.
useCropDimensions
boolUse crop dimensions to have the output image sized according to the predefined crop sizes, this will override the width and height parameters.
cacheBusterValue
stringAdd a serialized date of the last edit of the item to ensure client cache refresh when updated.
furtherOptions
stringThese 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
MediaWithCropsThe MediaWithCrops item.
width
int?The width of the output image.
height
int?The height of the output image.
propertyAlias
stringProperty alias of the property containing the JSON data.
cropAlias
stringThe crop alias.
quality
int?Quality percentage of the output image.
imageCropMode
ImageCropMode?The image crop mode.
imageCropAnchor
ImageCropAnchor?The image crop anchor.
preferFocalPoint
boolUse focal point, to generate an output image using the focal point instead of the predefined crop.
useCropDimensions
boolUse crop dimensions to have the output image sized according to the predefined crop sizes, this will override the width and height parameters.
cacheBuster
boolAdd a serialized date of the last edit of the item to ensure client cache refresh when updated.
furtherOptions
stringThese are any query string parameters (formatted as query strings) that the underlying image processing service supports. For example: <example>
furtherOptions: "bgcolor=fff"
urlMode
UrlModeThe 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
MediaWithCropsThe MediaWithCrops item.
propertyAlias
stringThe property alias of the property containing the JSON data e.g. umbracoFile.
cropAlias
stringThe crop alias e.g. thumbnail.
urlMode
UrlModeThe 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
MediaWithCropsThe MediaWithCrops item.
cropAlias
stringThe crop alias e.g. thumbnail.
urlMode
UrlModeThe 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
IPublishedContentThe IPublishedContent item.
width
int?The width of the output image.
height
int?The height of the output image.
propertyAlias
stringProperty alias of the property containing the JSON data.
cropAlias
stringThe crop alias.
quality
int?Quality percentage of the output image.
imageCropMode
ImageCropMode?The image crop mode.
imageCropAnchor
ImageCropAnchor?The image crop anchor.
preferFocalPoint
boolUse focal point, to generate an output image using the focal point instead of the predefined crop.
useCropDimensions
boolUse crop dimensions to have the output image sized according to the predefined crop sizes, this will override the width and height parameters.
cacheBuster
boolAdd a serialized date of the last edit of the item to ensure client cache refresh when updated.
furtherOptions
stringThese are any query string parameters (formatted as query strings) that the underlying image processing service supports. For example: <example>
furtherOptions: "bgcolor=fff"
urlMode
UrlModeThe 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
IPublishedContentThe IPublishedContent item.
propertyAlias
stringThe property alias of the property containing the JSON data e.g. umbracoFile.
cropAlias
stringThe crop alias e.g. thumbnail.
urlMode
UrlModeThe 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
IPublishedContentThe IPublishedContent item.
cropAlias
stringThe crop alias e.g. thumbnail.
urlMode
UrlModeThe 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
IPublishedContentThe media item.
imageCropperValue
ImageCropperValueThe image cropper value.
cropAlias
stringThe crop alias.
urlMode
UrlModeThe url mode.
Returns
- string
The image crop URL.