Class ImageCropperTemplateExtensions
Provides extension methods for getting ImageProcessor URL from the core Image Cropper property editor
Inheritance
Namespace: Umbraco.Web
Assembly: Umbraco.Web.dll
Syntax
public static class ImageCropperTemplateExtensions
Methods
View SourceGetCropUrl(String, Nullable<Int32>, Nullable<Int32>, String, String, Nullable<Int32>, Nullable<ImageCropMode>, Nullable<ImageCropAnchor>, Boolean, Boolean, String, String, Nullable<ImageCropRatioMode>, Boolean)
Gets the ImageProcessor 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, ImageCropRatioMode? ratioMode = null, bool upScale = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | imageUrl | The image URL. |
System.Nullable<System.Int32> | width | The width of the output image. |
System.Nullable<System.Int32> | height | The height of the output image. |
System.String | imageCropperValue | The Json data from the Umbraco Core Image Cropper property editor |
System.String | cropAlias | The crop alias. |
System.Nullable<System.Int32> | quality | Quality percentage of the output image. |
System.Nullable<ImageCropMode> | imageCropMode | The image crop mode. |
System.Nullable<ImageCropAnchor> | imageCropAnchor | The image crop anchor. |
System.Boolean | preferFocalPoint | Use focal point to generate an output image using the focal point instead of the predefined crop if there is one |
System.Boolean | useCropDimensions | Use crop dimensions to have the output image sized according to the predefined crop sizes, this will override the width and height parameters |
System.String | cacheBusterValue | Add a serialized date of the last edit of the item to ensure client cache refresh when updated |
System.String | furtherOptions | These are any query string parameters (formatted as query strings) that ImageProcessor supports. For example:
furtherOptions: "&bgcolor=fff" |
System.Nullable<ImageCropRatioMode> | ratioMode | Use a dimension as a ratio |
System.Boolean | upScale | If the image should be upscaled to requested dimensions |
Returns
Type | Description |
---|---|
System.String | The System.String. |
GetCropUrl(String, ImageCropperValue, Nullable<Int32>, Nullable<Int32>, String, Nullable<Int32>, Nullable<ImageCropMode>, Nullable<ImageCropAnchor>, Boolean, Boolean, String, String, Nullable<ImageCropRatioMode>, Boolean)
Gets the ImageProcessor 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, ImageCropRatioMode? ratioMode = null, bool upScale = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | imageUrl | The image URL. |
ImageCropperValue | cropDataSet | |
System.Nullable<System.Int32> | width | The width of the output image. |
System.Nullable<System.Int32> | height | The height of the output image. |
System.String | cropAlias | The crop alias. |
System.Nullable<System.Int32> | quality | Quality percentage of the output image. |
System.Nullable<ImageCropMode> | imageCropMode | The image crop mode. |
System.Nullable<ImageCropAnchor> | imageCropAnchor | The image crop anchor. |
System.Boolean | preferFocalPoint | Use focal point to generate an output image using the focal point instead of the predefined crop if there is one |
System.Boolean | useCropDimensions | Use crop dimensions to have the output image sized according to the predefined crop sizes, this will override the width and height parameters |
System.String | cacheBusterValue | Add a serialized date of the last edit of the item to ensure client cache refresh when updated |
System.String | furtherOptions | These are any query string parameters (formatted as query strings) that ImageProcessor supports. For example:
furtherOptions: "&bgcolor=fff" |
System.Nullable<ImageCropRatioMode> | ratioMode | Use a dimension as a ratio |
System.Boolean | upScale | If the image should be upscaled to requested dimensions |
Returns
Type | Description |
---|---|
System.String | The System.String. |
GetCropUrl(MediaWithCrops, Nullable<Int32>, Nullable<Int32>, String, String, Nullable<Int32>, Nullable<ImageCropMode>, Nullable<ImageCropAnchor>, Boolean, Boolean, Boolean, String, Nullable<ImageCropRatioMode>, Boolean)
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, ImageCropRatioMode? ratioMode = null, bool upScale = true)
Parameters
Type | Name | Description |
---|---|---|
MediaWithCrops | mediaWithCrops | |
System.Nullable<System.Int32> | width | |
System.Nullable<System.Int32> | height | |
System.String | propertyAlias | |
System.String | cropAlias | |
System.Nullable<System.Int32> | quality | |
System.Nullable<ImageCropMode> | imageCropMode | |
System.Nullable<ImageCropAnchor> | imageCropAnchor | |
System.Boolean | preferFocalPoint | |
System.Boolean | useCropDimensions | |
System.Boolean | cacheBuster | |
System.String | furtherOptions | |
System.Nullable<ImageCropRatioMode> | ratioMode | |
System.Boolean | upScale |
Returns
Type | Description |
---|---|
System.String |
GetCropUrl(MediaWithCrops, String)
Declaration
public static string GetCropUrl(this MediaWithCrops mediaWithCrops, string cropAlias)
Parameters
Type | Name | Description |
---|---|---|
MediaWithCrops | mediaWithCrops | |
System.String | cropAlias |
Returns
Type | Description |
---|---|
System.String |
GetCropUrl(MediaWithCrops, String, String)
Declaration
public static string GetCropUrl(this MediaWithCrops mediaWithCrops, string propertyAlias, string cropAlias)
Parameters
Type | Name | Description |
---|---|---|
MediaWithCrops | mediaWithCrops | |
System.String | propertyAlias | |
System.String | cropAlias |
Returns
Type | Description |
---|---|
System.String |
GetCropUrl(IPublishedContent, Nullable<Int32>, Nullable<Int32>, String, String, Nullable<Int32>, Nullable<ImageCropMode>, Nullable<ImageCropAnchor>, Boolean, Boolean, Boolean, String, Nullable<ImageCropRatioMode>, Boolean)
Gets the ImageProcessor 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, ImageCropRatioMode? ratioMode = null, bool upScale = true)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | mediaItem | The IPublishedContent item. |
System.Nullable<System.Int32> | width | The width of the output image. |
System.Nullable<System.Int32> | height | The height of the output image. |
System.String | propertyAlias | Property alias of the property containing the Json data. |
System.String | cropAlias | The crop alias. |
System.Nullable<System.Int32> | quality | Quality percentage of the output image. |
System.Nullable<ImageCropMode> | imageCropMode | The image crop mode. |
System.Nullable<ImageCropAnchor> | imageCropAnchor | The image crop anchor. |
System.Boolean | preferFocalPoint | Use focal point, to generate an output image using the focal point instead of the predefined crop |
System.Boolean | useCropDimensions | Use crop dimensions to have the output image sized according to the predefined crop sizes, this will override the width and height parameters. |
System.Boolean | cacheBuster | Add a serialized date of the last edit of the item to ensure client cache refresh when updated |
System.String | furtherOptions | These are any query string parameters (formatted as query strings) that ImageProcessor supports. For example:
furtherOptions: "&bgcolor=fff" |
System.Nullable<ImageCropRatioMode> | ratioMode | Use a dimension as a ratio |
System.Boolean | upScale | If the image should be upscaled to requested dimensions |
Returns
Type | Description |
---|---|
System.String | The System.String. |
GetCropUrl(IPublishedContent, String)
Gets the ImageProcessor URL by the crop alias (from the "umbracoFile" property alias) on the IPublishedContent item
Declaration
public static string GetCropUrl(this IPublishedContent mediaItem, string cropAlias)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | mediaItem | The IPublishedContent item. |
System.String | cropAlias | The crop alias e.g. thumbnail |
Returns
Type | Description |
---|---|
System.String | The ImageProcessor.Web URL. |
GetCropUrl(IPublishedContent, String, String)
Gets the ImageProcessor 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)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | mediaItem | The IPublishedContent item. |
System.String | propertyAlias | The property alias of the property containing the Json data e.g. umbracoFile |
System.String | cropAlias | The crop alias e.g. thumbnail |
Returns
Type | Description |
---|---|
System.String | The ImageProcessor.Web URL. |
GetCropUrl(IPublishedContent, String, ImageCropperValue)
Declaration
[Obsolete("Use the GetCropUrl overload with the updated parameter order and note this implementation has changed to get the URL from the media item.")]
public static string GetCropUrl(this IPublishedContent mediaItem, string cropAlias, ImageCropperValue imageCropperValue)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | mediaItem | |
System.String | cropAlias | |
ImageCropperValue | imageCropperValue |
Returns
Type | Description |
---|---|
System.String |
GetCropUrl(IPublishedContent, ImageCropperValue, String)
Gets the crop URL by using only the specified imageCropperValue
.
Declaration
public static string GetCropUrl(this IPublishedContent mediaItem, ImageCropperValue imageCropperValue, string cropAlias)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | mediaItem | The media item. |
ImageCropperValue | imageCropperValue | The image cropper value. |
System.String | cropAlias | The crop alias. |
Returns
Type | Description |
---|---|
System.String | The image crop URL. |
GetLocalCropUrl(MediaWithCrops, String, String)
Declaration
[Obsolete("Use GetCrop to merge local and media crops, get automatic cache buster value and have more parameters.")]
public static string GetLocalCropUrl(this MediaWithCrops mediaWithCrops, string alias, string cacheBusterValue = null)
Parameters
Type | Name | Description |
---|---|---|
MediaWithCrops | mediaWithCrops | |
System.String | alias | |
System.String | cacheBusterValue |
Returns
Type | Description |
---|---|
System.String |