Reverts changes made for U4-8963

This commit is contained in:
Shannon
2017-04-19 15:41:26 +10:00
parent 7c491c1fc1
commit 1402494e47
4 changed files with 95 additions and 48 deletions

View File

@@ -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
/// </param>
/// <param name="furtherOptions">
/// The further options.
/// These are any query string parameters (formatted as query strings) that ImageProcessor supports. For example:
/// <example>
/// <![CDATA[
/// furtherOptions: "&bgcolor=fff"
/// ]]>
/// </example>
/// </param>
/// <param name="ratioMode">
/// Use a dimension as a ratio
/// </param>
/// <param name="upScale">
/// If the image should be upscaled to requested dimensions
/// </param>
/// <param name="backgroundColor">
/// Changes the background color of the image. Used when adding a background when resizing image formats without an alpha channel.
/// </param>
/// </param>
/// <returns>
/// The <see cref="string"/>.
/// </returns>
@@ -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);
}
/// <summary>
@@ -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
/// </param>
/// <param name="furtherOptions">
/// The further options.
/// These are any query string parameters (formatted as query strings) that ImageProcessor supports. For example:
/// <example>
/// <![CDATA[
/// furtherOptions: "&bgcolor=fff"
/// ]]>
/// </example>
/// </param>
/// <param name="ratioMode">
/// Use a dimension as a ratio
/// </param>
/// <param name="upScale">
/// If the image should be upscaled to requested dimensions
/// </param>
/// <param name="backgroundColor">
/// Changes the background color of the image. Used when adding a background when resizing image formats without an alpha channel.
/// </param>
/// </param>
/// <returns>
/// The <see cref="string"/>.
/// </returns>
@@ -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);
}
/// <summary>
/// Gets the ImageProcessor Url from the image path.
/// </summary>
/// <param name="imageUrl">
/// The image url.
/// </param>
/// <param name="cropDataSet"></param>
/// <param name="width">
/// The width of the output image.
/// </param>
/// <param name="height">
/// The height of the output image.
/// </param>
/// <param name="cropAlias">
/// The crop alias.
/// </param>
/// <param name="quality">
/// Quality percentage of the output image.
/// </param>
/// <param name="imageCropMode">
/// The image crop mode.
/// </param>
/// <param name="imageCropAnchor">
/// The image crop anchor.
/// </param>
/// <param name="preferFocalPoint">
/// Use focal point to generate an output image using the focal point instead of the predefined crop if there is one
/// </param>
/// <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>
/// <param name="cacheBusterValue">
/// Add a serialised date of the last edit of the item to ensure client cache refresh when updated
/// </param>
/// <param name="furtherOptions">
/// These are any query string parameters (formatted as query strings) that ImageProcessor supports. For example:
/// <example>
/// <![CDATA[
/// furtherOptions: "&bgcolor=fff"
/// ]]>
/// </example>
/// </param>
/// <param name="ratioMode">
/// Use a dimension as a ratio
/// </param>
/// <param name="upScale">
/// If the image should be upscaled to requested dimensions
/// </param>
/// <returns>
/// The <see cref="string"/>.
/// </returns>
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);