diff --git a/src/Umbraco.Tests/PropertyEditors/ImageCropperTest.cs b/src/Umbraco.Tests/PropertyEditors/ImageCropperTest.cs
index 062ab164b0..3c1d4e7c9b 100644
--- a/src/Umbraco.Tests/PropertyEditors/ImageCropperTest.cs
+++ b/src/Umbraco.Tests/PropertyEditors/ImageCropperTest.cs
@@ -376,7 +376,7 @@ namespace Umbraco.Tests.PropertyEditors
{
var cropperJson = "{\"focalPoint\": {\"left\": 0.5,\"top\": 0.5},\"src\": \"" + mediaPath + "\",\"crops\": [{\"alias\": \"home\",\"width\": 270,\"height\": 161}]}";
- var urlString = mediaPath.GetCropUrl(400, 400, cropperJson, imageCropMode: ImageCropMode.Pad, backgroundColor: "fff");
+ var urlString = mediaPath.GetCropUrl(400, 400, cropperJson, imageCropMode: ImageCropMode.Pad, furtherOptions: "&bgcolor=fff");
Assert.AreEqual(mediaPath + "?mode=pad&width=400&height=400&bgcolor=fff", urlString);
}
}
diff --git a/src/Umbraco.Web/HtmlHelperRenderExtensions.cs b/src/Umbraco.Web/HtmlHelperRenderExtensions.cs
index 2802e4fe80..3062613b6b 100644
--- a/src/Umbraco.Web/HtmlHelperRenderExtensions.cs
+++ b/src/Umbraco.Web/HtmlHelperRenderExtensions.cs
@@ -228,13 +228,12 @@ namespace Umbraco.Web
bool cacheBuster = true,
string furtherOptions = null,
ImageCropRatioMode? ratioMode = null,
- bool upScale = true,
- string backgroundColor = null)
+ bool upScale = true)
{
return
new HtmlString(mediaItem.GetCropUrl(width, height, propertyAlias, cropAlias, quality, imageCropMode,
imageCropAnchor, preferFocalPoint, useCropDimensions, cacheBuster, furtherOptions, ratioMode,
- upScale, backgroundColor));
+ upScale));
}
[Obsolete("Use the UrlHelper.GetCropUrl extension instead")]
@@ -253,13 +252,12 @@ namespace Umbraco.Web
string cacheBusterValue = null,
string furtherOptions = null,
ImageCropRatioMode? ratioMode = null,
- bool upScale = true,
- string backgroundColor = null)
+ bool upScale = true)
{
return
new HtmlString(imageUrl.GetCropUrl(width, height, imageCropperValue, cropAlias, quality, imageCropMode,
imageCropAnchor, preferFocalPoint, useCropDimensions, cacheBusterValue, furtherOptions, ratioMode,
- upScale, backgroundColor));
+ upScale));
}
#endregion
diff --git a/src/Umbraco.Web/ImageCropperTemplateExtensions.cs b/src/Umbraco.Web/ImageCropperTemplateExtensions.cs
index 08781076dc..ddf8ee0727 100644
--- a/src/Umbraco.Web/ImageCropperTemplateExtensions.cs
+++ b/src/Umbraco.Web/ImageCropperTemplateExtensions.cs
@@ -87,17 +87,19 @@ namespace Umbraco.Web
/// Add a serialised date of the last edit of the item to ensure client cache refresh when updated
///
///
- /// The further options.
+ /// These are any query string parameters (formatted as query strings) that ImageProcessor supports. For example:
+ ///
+ ///
+ ///
///
///
/// Use a dimension as a ratio
///
///
/// If the image should be upscaled to requested dimensions
- ///
- ///
- /// Changes the background color of the image. Used when adding a background when resizing image formats without an alpha channel.
- ///
+ ///
///
/// The .
///
@@ -115,8 +117,7 @@ namespace Umbraco.Web
bool cacheBuster = true,
string furtherOptions = null,
ImageCropRatioMode? ratioMode = null,
- bool upScale = true,
- string backgroundColor = null)
+ bool upScale = true)
{
if (mediaItem == null) throw new ArgumentNullException("mediaItem");
@@ -136,7 +137,7 @@ namespace Umbraco.Web
mediaItemUrl = stronglyTyped.Src;
return GetCropUrl(
mediaItemUrl, stronglyTyped, width, height, cropAlias, quality, imageCropMode, imageCropAnchor, preferFocalPoint, useCropDimensions,
- cacheBusterValue, furtherOptions, ratioMode, upScale, backgroundColor);
+ cacheBusterValue, furtherOptions, ratioMode, upScale);
}
//this shouldn't be the case but we'll check
@@ -147,14 +148,14 @@ namespace Umbraco.Web
mediaItemUrl = stronglyTyped.Src;
return GetCropUrl(
mediaItemUrl, stronglyTyped, width, height, cropAlias, quality, imageCropMode, imageCropAnchor, preferFocalPoint, useCropDimensions,
- cacheBusterValue, furtherOptions, ratioMode, upScale, backgroundColor);
+ cacheBusterValue, furtherOptions, ratioMode, upScale);
}
//it's a single string
mediaItemUrl = cropperValue.ToString();
return GetCropUrl(
mediaItemUrl, width, height, mediaItemUrl, cropAlias, quality, imageCropMode, imageCropAnchor, preferFocalPoint, useCropDimensions,
- cacheBusterValue, furtherOptions, ratioMode, upScale, backgroundColor);
+ cacheBusterValue, furtherOptions, ratioMode, upScale);
}
///
@@ -194,17 +195,19 @@ namespace Umbraco.Web
/// Add a serialised date of the last edit of the item to ensure client cache refresh when updated
///
///
- /// The further options.
+ /// These are any query string parameters (formatted as query strings) that ImageProcessor supports. For example:
+ ///
+ ///
+ ///
///
///
/// Use a dimension as a ratio
///
///
/// If the image should be upscaled to requested dimensions
- ///
- ///
- /// Changes the background color of the image. Used when adding a background when resizing image formats without an alpha channel.
- ///
+ ///
///
/// The .
///
@@ -222,8 +225,7 @@ namespace Umbraco.Web
string cacheBusterValue = null,
string furtherOptions = null,
ImageCropRatioMode? ratioMode = null,
- bool upScale = true,
- string backgroundColor = null)
+ bool upScale = true)
{
if (string.IsNullOrEmpty(imageUrl)) return string.Empty;
@@ -234,9 +236,60 @@ namespace Umbraco.Web
}
return GetCropUrl(
imageUrl, cropDataSet, width, height, cropAlias, quality, imageCropMode,
- imageCropAnchor, preferFocalPoint, useCropDimensions, cacheBusterValue, furtherOptions, ratioMode, upScale, backgroundColor);
+ imageCropAnchor, preferFocalPoint, useCropDimensions, cacheBusterValue, furtherOptions, ratioMode, upScale);
}
+ ///
+ /// Gets the ImageProcessor Url from the image path.
+ ///
+ ///
+ /// The image url.
+ ///
+ ///
+ ///
+ /// The width of the output image.
+ ///
+ ///
+ /// The height of the output image.
+ ///
+ ///
+ /// The crop alias.
+ ///
+ ///
+ /// Quality percentage of the output image.
+ ///
+ ///
+ /// The image crop mode.
+ ///
+ ///
+ /// The image crop anchor.
+ ///
+ ///
+ /// Use focal point to generate an output image using the focal point instead of the predefined crop if there is one
+ ///
+ ///
+ /// Use crop dimensions to have the output image sized according to the predefined crop sizes, this will override the width and height parameters
+ ///
+ ///
+ /// Add a serialised date of the last edit of the item to ensure client cache refresh when updated
+ ///
+ ///
+ /// These are any query string parameters (formatted as query strings) that ImageProcessor supports. For example:
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Use a dimension as a ratio
+ ///
+ ///
+ /// If the image should be upscaled to requested dimensions
+ ///
+ ///
+ /// The .
+ ///
public static string GetCropUrl(
this string imageUrl,
ImageCropDataSet cropDataSet,
@@ -251,8 +304,7 @@ namespace Umbraco.Web
string cacheBusterValue = null,
string furtherOptions = null,
ImageCropRatioMode? ratioMode = null,
- bool upScale = true,
- string backgroundColor = null)
+ bool upScale = true)
{
if (string.IsNullOrEmpty(imageUrl) == false)
{
@@ -359,11 +411,6 @@ namespace Umbraco.Web
imageProcessorUrl.Append("&upscale=false");
}
- if (backgroundColor != null)
- {
- imageProcessorUrl.Append("&bgcolor=" + backgroundColor);
- }
-
if (furtherOptions != null)
{
imageProcessorUrl.Append(furtherOptions);
diff --git a/src/Umbraco.Web/UrlHelperRenderExtensions.cs b/src/Umbraco.Web/UrlHelperRenderExtensions.cs
index 76a000aded..614c815f79 100644
--- a/src/Umbraco.Web/UrlHelperRenderExtensions.cs
+++ b/src/Umbraco.Web/UrlHelperRenderExtensions.cs
@@ -101,7 +101,12 @@ namespace Umbraco.Web
/// Add a serialised date of the last edit of the item to ensure client cache refresh when updated
///
///
- /// The further options.
+ /// These are any query string parameters (formatted as query strings) that ImageProcessor supports. For example:
+ ///
+ ///
+ ///
///
///
/// Use a dimension as a ratio
@@ -113,10 +118,7 @@ namespace Umbraco.Web
///
/// Whether to HTML encode this URL - default is true - w3c standards require html attributes to be html encoded but this can be
/// set to false if using the result of this method for CSS.
- ///
- ///
- /// Changes the background color of the image. Used when adding a background when resizing image formats without an alpha channel.
- ///
+ ///
///
/// The .
///
@@ -135,12 +137,11 @@ namespace Umbraco.Web
string furtherOptions = null,
ImageCropRatioMode? ratioMode = null,
bool upScale = true,
- bool htmlEncode = true,
- string backgroundColor = null)
+ bool htmlEncode = true)
{
var url = mediaItem.GetCropUrl(width, height, propertyAlias, cropAlias, quality, imageCropMode,
imageCropAnchor, preferFocalPoint, useCropDimensions, cacheBuster, furtherOptions, ratioMode,
- upScale, backgroundColor);
+ upScale);
return htmlEncode ? new HtmlString(HttpUtility.HtmlEncode(url)) : new HtmlString(url);
}
@@ -181,7 +182,12 @@ namespace Umbraco.Web
/// Add a serialised date of the last edit of the item to ensure client cache refresh when updated
///
///
- /// The further options.
+ /// These are any query string parameters (formatted as query strings) that ImageProcessor supports. For example:
+ ///
+ ///
+ ///
///
///
/// Use a dimension as a ratio
@@ -193,10 +199,7 @@ namespace Umbraco.Web
///
/// Whether to HTML encode this URL - default is true - w3c standards require html attributes to be html encoded but this can be
/// set to false if using the result of this method for CSS.
- ///
- ///
- /// Changes the background color of the image. Used when adding a background when resizing image formats without an alpha channel.
- ///
+ ///
///
/// The .
///
@@ -215,12 +218,11 @@ namespace Umbraco.Web
string furtherOptions = null,
ImageCropRatioMode? ratioMode = null,
bool upScale = true,
- bool htmlEncode = true,
- string backgroundColor = null)
+ bool htmlEncode = true)
{
var url = imageUrl.GetCropUrl(width, height, imageCropperValue, cropAlias, quality, imageCropMode,
imageCropAnchor, preferFocalPoint, useCropDimensions, cacheBusterValue, furtherOptions, ratioMode,
- upScale, backgroundColor);
+ upScale);
return htmlEncode ? new HtmlString(HttpUtility.HtmlEncode(url)) : new HtmlString(url);
}