Skip to content

Commit 7524b78

Browse files
lauranetomikecp
authored andcommitted
Added missing documentation to Image Cropper Extensions
1 parent de12605 commit 7524b78

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

src/Umbraco.Web.Common/Extensions/FriendlyImageCropperTemplateExtensions.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ public static string GetCropUrl(
3232
UrlMode urlMode = UrlMode.Default) =>
3333
mediaItem.GetCropUrl(cropAlias, ImageUrlGenerator, PublishedValueFallback, PublishedUrlProvider, urlMode);
3434

35+
/// <summary>
36+
/// 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.
37+
/// </summary>
38+
/// <param name="mediaWithCrops">The MediaWithCrops item.</param>
39+
/// <param name="cropAlias">The crop alias e.g. thumbnail.</param>
40+
/// <param name="urlMode">The url mode.</param>
41+
/// <returns>
42+
/// The URL of the cropped image.
43+
/// </returns>
3544
public static string GetCropUrl(this MediaWithCrops mediaWithCrops, string cropAlias, UrlMode urlMode = UrlMode.Default)
3645
=> ImageCropperTemplateCoreExtensions.GetCropUrl(mediaWithCrops, cropAlias, ImageUrlGenerator, PublishedValueFallback, PublishedUrlProvider, urlMode);
3746

@@ -69,6 +78,16 @@ public static string GetCropUrl(
6978
UrlMode urlMode = UrlMode.Default) =>
7079
mediaItem.GetCropUrl(propertyAlias, cropAlias, ImageUrlGenerator, PublishedValueFallback, PublishedUrlProvider, urlMode);
7180

81+
/// <summary>
82+
/// 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.
83+
/// </summary>
84+
/// <param name="mediaWithCrops">The MediaWithCrops item.</param>
85+
/// <param name="propertyAlias">The property alias of the property containing the JSON data e.g. umbracoFile.</param>
86+
/// <param name="cropAlias">The crop alias e.g. thumbnail.</param>
87+
/// <param name="urlMode">The url mode.</param>
88+
/// <returns>
89+
/// The URL of the cropped image.
90+
/// </returns>
7291
public static string GetCropUrl(this MediaWithCrops mediaWithCrops, string propertyAlias, string cropAlias, UrlMode urlMode = UrlMode.Default)
7392
=> ImageCropperTemplateCoreExtensions.GetCropUrl(mediaWithCrops, propertyAlias, cropAlias, ImageUrlGenerator, PublishedValueFallback, PublishedUrlProvider, urlMode);
7493

src/Umbraco.Web.Common/Extensions/ImageCropperTemplateCoreExtensions.cs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,18 @@ public static string GetCropUrl(
3232
IPublishedUrlProvider publishedUrlProvider,
3333
UrlMode urlMode = UrlMode.Default) => mediaItem.GetCropUrl(imageUrlGenerator, publishedValueFallback, publishedUrlProvider, cropAlias: cropAlias, useCropDimensions: true, urlMode: urlMode);
3434

35+
/// <summary>
36+
/// 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.
37+
/// </summary>
38+
/// <param name="mediaWithCrops">The MediaWithCrops item.</param>
39+
/// <param name="cropAlias">The crop alias e.g. thumbnail.</param>
40+
/// <param name="imageUrlGenerator">The image URL generator.</param>
41+
/// <param name="publishedValueFallback">The published value fallback.</param>
42+
/// <param name="publishedUrlProvider">The published URL provider.</param>
43+
/// <param name="urlMode">The url mode.</param>
44+
/// <returns>
45+
/// The URL of the cropped image.
46+
/// </returns>
3547
public static string GetCropUrl(
3648
this MediaWithCrops mediaWithCrops,
3749
string cropAlias,
@@ -84,6 +96,19 @@ public static string GetCropUrl(
8496
IPublishedUrlProvider publishedUrlProvider,
8597
UrlMode urlMode = UrlMode.Default) => mediaItem.GetCropUrl(imageUrlGenerator, publishedValueFallback, publishedUrlProvider, propertyAlias: propertyAlias, cropAlias: cropAlias, useCropDimensions: true, urlMode: urlMode);
8698

99+
/// <summary>
100+
/// 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.
101+
/// </summary>
102+
/// <param name="mediaWithCrops">The MediaWithCrops item.</param>
103+
/// <param name="propertyAlias">The property alias of the property containing the JSON data e.g. umbracoFile.</param>
104+
/// <param name="cropAlias">The crop alias e.g. thumbnail.</param>
105+
/// <param name="imageUrlGenerator">The image URL generator.</param>
106+
/// <param name="publishedValueFallback">The published value fallback.</param>
107+
/// <param name="publishedUrlProvider">The published URL provider.</param>
108+
/// <param name="urlMode">The url mode.</param>
109+
/// <returns>
110+
/// The URL of the cropped image.
111+
/// </returns>
87112
public static string GetCropUrl(this MediaWithCrops mediaWithCrops,
88113
IPublishedValueFallback publishedValueFallback,
89114
IPublishedUrlProvider publishedUrlProvider,
@@ -135,6 +160,31 @@ public static string GetCropUrl(
135160
string furtherOptions = null,
136161
UrlMode urlMode = UrlMode.Default) => mediaItem.GetCropUrl(imageUrlGenerator, publishedValueFallback, publishedUrlProvider, null, false, width, height, propertyAlias, cropAlias, quality, imageCropMode, imageCropAnchor, preferFocalPoint, useCropDimensions, cacheBuster, furtherOptions, urlMode);
137162

163+
/// <summary>
164+
/// Gets the underlying image processing service URL from the MediaWithCrops item.
165+
/// </summary>
166+
/// <param name="mediaWithCrops">The MediaWithCrops item.</param>
167+
/// <param name="imageUrlGenerator">The image URL generator.</param>
168+
/// <param name="publishedValueFallback">The published value fallback.</param>
169+
/// <param name="publishedUrlProvider">The published URL provider.</param>
170+
/// <param name="width">The width of the output image.</param>
171+
/// <param name="height">The height of the output image.</param>
172+
/// <param name="propertyAlias">Property alias of the property containing the JSON data.</param>
173+
/// <param name="cropAlias">The crop alias.</param>
174+
/// <param name="quality">Quality percentage of the output image.</param>
175+
/// <param name="imageCropMode">The image crop mode.</param>
176+
/// <param name="imageCropAnchor">The image crop anchor.</param>
177+
/// <param name="preferFocalPoint">Use focal point, to generate an output image using the focal point instead of the predefined crop.</param>
178+
/// <param name="useCropDimensions">Use crop dimensions to have the output image sized according to the predefined crop sizes, this will override the width and height parameters.</param>
179+
/// <param name="cacheBuster">Add a serialized date of the last edit of the item to ensure client cache refresh when updated.</param>
180+
/// <param name="furtherOptions">These are any query string parameters (formatted as query strings) that ImageProcessor supports. For example:
181+
/// <example><![CDATA[
182+
/// furtherOptions: "bgcolor=fff"
183+
/// ]]></example></param>
184+
/// <param name="urlMode">The url mode.</param>
185+
/// <returns>
186+
/// The URL of the cropped image.
187+
/// </returns>
138188
public static string GetCropUrl(
139189
this MediaWithCrops mediaWithCrops,
140190
IImageUrlGenerator imageUrlGenerator,

0 commit comments

Comments
 (0)