Class FriendlyImageCropperTemplateExtensions
Inheritance
Namespace: Umbraco.Extensions
Assembly: Umbraco.Web.Common.dll
Syntax
public static class FriendlyImageCropperTemplateExtensions
Methods
View SourceGetCropUrl(string, int?, int?, string?, string?, int?, ImageCropMode?, ImageCropAnchor?, bool, bool, string?, string?, int?, int?)
Gets the underlying image processing service URL from the image path.
Declaration
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, int? sourceWidth = null, int? sourceHeight = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | imageUrl | The image URL. |
| int? | width | The width of the output image. |
| int? | height | The height of the output image. |
| string | imageCropperValue | The JSON data from the Umbraco Core Image Cropper property editor. |
| string | cropAlias | The crop alias. |
| int? | quality | Quality percentage of the output image. |
| ImageCropMode? | imageCropMode | The image crop mode. |
| ImageCropAnchor? | imageCropAnchor | The image crop anchor. |
| bool | preferFocalPoint | Use focal point to generate an output image using the focal point instead of the predefined crop if there is one. |
| bool | useCropDimensions | Use crop dimensions to have the output image sized according to the predefined crop sizes, this will override the width and height parameters. |
| string | cacheBusterValue | Add a serialized date of the last edit of the item to ensure client cache refresh when updated. |
| string | furtherOptions |
furtherOptions: "bgcolor=fff" |
| int? | sourceWidth | The width of the source image. |
| int? | sourceHeight | The height of the source image. |
Returns
| Type | Description |
|---|---|
| string | The URL of the cropped image. |
GetCropUrl(string, ImageCropperValue, int?, int?, string?, int?, ImageCropMode?, ImageCropAnchor?, bool, bool, string?, string?, int?, int?)
Gets the underlying image processing service URL from the image path.
Declaration
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, int? sourceWidth = null, int? sourceHeight = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | imageUrl | The image URL. |
| ImageCropperValue | cropDataSet | The crop data set. |
| int? | width | The width of the output image. |
| int? | height | The height of the output image. |
| string | cropAlias | The crop alias. |
| int? | quality | Quality percentage of the output image. |
| ImageCropMode? | imageCropMode | The image crop mode. |
| ImageCropAnchor? | imageCropAnchor | The image crop anchor. |
| bool | preferFocalPoint | Use focal point to generate an output image using the focal point instead of the predefined crop if there is one. |
| bool | useCropDimensions | Use crop dimensions to have the output image sized according to the predefined crop sizes, this will override the width and height parameters. |
| string | cacheBusterValue | Add a serialized date of the last edit of the item to ensure client cache refresh when updated. |
| string | furtherOptions |
furtherOptions: "bgcolor=fff" |
| int? | sourceWidth | The width of the source image. |
| int? | sourceHeight | The height of the source image. |
Returns
| Type | Description |
|---|---|
| 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.
Declaration
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 = UrlMode.Default)
Parameters
| Type | Name | Description |
|---|---|---|
| MediaWithCrops | mediaWithCrops | The MediaWithCrops item. |
| int? | width | The width of the output image. |
| int? | height | The height of the output image. |
| string | propertyAlias | Property alias of the property containing the JSON data. |
| string | cropAlias | The crop alias. |
| int? | quality | Quality percentage of the output image. |
| ImageCropMode? | imageCropMode | The image crop mode. |
| ImageCropAnchor? | imageCropAnchor | The image crop anchor. |
| bool | preferFocalPoint | Use focal point, to generate an output image using the focal point instead of the predefined crop. |
| bool | useCropDimensions | Use crop dimensions to have the output image sized according to the predefined crop sizes, this will override the width and height parameters. |
| bool | cacheBuster | Add a serialized date of the last edit of the item to ensure client cache refresh when updated. |
| string | furtherOptions |
furtherOptions: "bgcolor=fff" |
| UrlMode | urlMode | The url mode. |
Returns
| Type | Description |
|---|---|
| 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.
Declaration
public static string? GetCropUrl(this MediaWithCrops mediaWithCrops, string propertyAlias, string cropAlias, UrlMode urlMode = UrlMode.Default)
Parameters
| Type | Name | Description |
|---|---|---|
| MediaWithCrops | mediaWithCrops | The MediaWithCrops item. |
| string | propertyAlias | The property alias of the property containing the JSON data e.g. umbracoFile. |
| string | cropAlias | The crop alias e.g. thumbnail. |
| UrlMode | urlMode | The url mode. |
Returns
| Type | Description |
|---|---|
| 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.
Declaration
public static string? GetCropUrl(this MediaWithCrops mediaWithCrops, string cropAlias, UrlMode urlMode = UrlMode.Default)
Parameters
| Type | Name | Description |
|---|---|---|
| MediaWithCrops | mediaWithCrops | The MediaWithCrops item. |
| string | cropAlias | The crop alias e.g. thumbnail. |
| UrlMode | urlMode | The url mode. |
Returns
| Type | Description |
|---|---|
| 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.
Declaration
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 = UrlMode.Default)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | mediaItem | The IPublishedContent item. |
| int? | width | The width of the output image. |
| int? | height | The height of the output image. |
| string | propertyAlias | Property alias of the property containing the JSON data. |
| string | cropAlias | The crop alias. |
| int? | quality | Quality percentage of the output image. |
| ImageCropMode? | imageCropMode | The image crop mode. |
| ImageCropAnchor? | imageCropAnchor | The image crop anchor. |
| bool | preferFocalPoint | Use focal point, to generate an output image using the focal point instead of the predefined crop. |
| bool | useCropDimensions | Use crop dimensions to have the output image sized according to the predefined crop sizes, this will override the width and height parameters. |
| bool | cacheBuster | Add a serialized date of the last edit of the item to ensure client cache refresh when updated. |
| string | furtherOptions |
furtherOptions: "bgcolor=fff" |
| UrlMode | urlMode | The url mode. |
Returns
| Type | Description |
|---|---|
| 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.
Declaration
public static string? GetCropUrl(this IPublishedContent mediaItem, string propertyAlias, string cropAlias, UrlMode urlMode = UrlMode.Default)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | mediaItem | The IPublishedContent item. |
| string | propertyAlias | The property alias of the property containing the JSON data e.g. umbracoFile. |
| string | cropAlias | The crop alias e.g. thumbnail. |
| UrlMode | urlMode | The url mode. |
Returns
| Type | Description |
|---|---|
| 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.
Declaration
public static string? GetCropUrl(this IPublishedContent mediaItem, string cropAlias, UrlMode urlMode = UrlMode.Default)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | mediaItem | The IPublishedContent item. |
| string | cropAlias | The crop alias e.g. thumbnail. |
| UrlMode | urlMode | The url mode. |
Returns
| Type | Description |
|---|---|
| string | The URL of the cropped image. |
GetCropUrl(IPublishedContent, ImageCropperValue, string, UrlMode)
Gets the crop URL by using only the specified imageCropperValue.
Declaration
public static string? GetCropUrl(this IPublishedContent mediaItem, ImageCropperValue imageCropperValue, string cropAlias, UrlMode urlMode = UrlMode.Default)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | mediaItem | The media item. |
| ImageCropperValue | imageCropperValue | The image cropper value. |
| string | cropAlias | The crop alias. |
| UrlMode | urlMode | The url mode. |
Returns
| Type | Description |
|---|---|
| string | The image crop URL. |