Class ImageCropperTemplateCoreExtensions
Inheritance
Namespace: Umbraco.Web
Assembly: Umbraco.Web.dll
Syntax
public static class ImageCropperTemplateCoreExtensions
Methods
View SourceGetCropUrl(String, IImageUrlGenerator, 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, IImageUrlGenerator imageUrlGenerator, 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. |
IImageUrlGenerator | imageUrlGenerator | |
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, IImageUrlGenerator, ImageCropperValue, Nullable<Int32>, Nullable<Int32>, String, Nullable<Int32>, Nullable<ImageCropMode>, Nullable<ImageCropAnchor>, Boolean, Boolean, String, String, Nullable<ImageCropRatioMode>, Boolean, String)
Gets the ImageProcessor URL from the image path.
Declaration
public static string GetCropUrl(this string imageUrl, IImageUrlGenerator imageUrlGenerator, 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, string animationProcessMode = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | imageUrl | The image URL. |
IImageUrlGenerator | imageUrlGenerator | The generator that will process all the options and the image URL to return a full image URLs with all processing options appended |
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 |
System.String | animationProcessMode |
Returns
Type | Description |
---|---|
System.String | The System.String. |
GetCropUrl(MediaWithCrops, String, String, IImageUrlGenerator)
Declaration
public static string GetCropUrl(this MediaWithCrops mediaWithCrops, string propertyAlias, string cropAlias, IImageUrlGenerator imageUrlGenerator)
Parameters
Type | Name | Description |
---|---|---|
MediaWithCrops | mediaWithCrops | |
System.String | propertyAlias | |
System.String | cropAlias | |
IImageUrlGenerator | imageUrlGenerator |
Returns
Type | Description |
---|---|
System.String |
GetCropUrl(MediaWithCrops, String, IImageUrlGenerator)
Declaration
public static string GetCropUrl(this MediaWithCrops mediaWithCrops, string cropAlias, IImageUrlGenerator imageUrlGenerator)
Parameters
Type | Name | Description |
---|---|---|
MediaWithCrops | mediaWithCrops | |
System.String | cropAlias | |
IImageUrlGenerator | imageUrlGenerator |
Returns
Type | Description |
---|---|
System.String |
GetCropUrl(MediaWithCrops, IImageUrlGenerator, 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, IImageUrlGenerator imageUrlGenerator, 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 | |
IImageUrlGenerator | imageUrlGenerator | |
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(IPublishedContent, String, String, IImageUrlGenerator)
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, IImageUrlGenerator imageUrlGenerator)
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 |
IImageUrlGenerator | imageUrlGenerator |
Returns
Type | Description |
---|---|
System.String | The ImageProcessor.Web URL. |
GetCropUrl(IPublishedContent, String, IImageUrlGenerator)
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, IImageUrlGenerator imageUrlGenerator)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | mediaItem | The IPublishedContent item. |
System.String | cropAlias | The crop alias e.g. thumbnail |
IImageUrlGenerator | imageUrlGenerator |
Returns
Type | Description |
---|---|
System.String | The ImageProcessor.Web URL. |
GetCropUrl(IPublishedContent, String, IImageUrlGenerator, 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, IImageUrlGenerator imageUrlGenerator, ImageCropperValue imageCropperValue)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | mediaItem | |
System.String | cropAlias | |
IImageUrlGenerator | imageUrlGenerator | |
ImageCropperValue | imageCropperValue |
Returns
Type | Description |
---|---|
System.String |
GetCropUrl(IPublishedContent, IImageUrlGenerator, 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, IImageUrlGenerator imageUrlGenerator, 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. |
IImageUrlGenerator | imageUrlGenerator | |
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, ImageCropperValue, String, IImageUrlGenerator)
Gets the crop URL by using only the specified imageCropperValue
.
Declaration
public static string GetCropUrl(this IPublishedContent mediaItem, ImageCropperValue imageCropperValue, string cropAlias, IImageUrlGenerator imageUrlGenerator)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | mediaItem | The media item. |
ImageCropperValue | imageCropperValue | The image cropper value. |
System.String | cropAlias | The crop alias. |
IImageUrlGenerator | imageUrlGenerator | The image URL generator. |
Returns
Type | Description |
---|---|
System.String | The image crop URL. |
GetLocalCropUrl(MediaWithCrops, String, IImageUrlGenerator, 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, IImageUrlGenerator imageUrlGenerator, string cacheBusterValue)
Parameters
Type | Name | Description |
---|---|---|
MediaWithCrops | mediaWithCrops | |
System.String | alias | |
IImageUrlGenerator | imageUrlGenerator | |
System.String | cacheBusterValue |
Returns
Type | Description |
---|---|
System.String |