Remove usage of obsolete image URL generation properties (width/height ratio, default crop, upscale and animation process mode)
This commit is contained in:
@@ -13,17 +13,13 @@ namespace Umbraco.Extensions
|
||||
public static class ImageCropperTemplateCoreExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the underlying image processing service URL by the crop alias (from the "umbracoFile" property alias) on the IPublishedContent item
|
||||
/// Gets the underlying image processing service URL by the crop alias (from the "umbracoFile" property alias) on the IPublishedContent item.
|
||||
/// </summary>
|
||||
/// <param name="mediaItem">
|
||||
/// The IPublishedContent item.
|
||||
/// </param>
|
||||
/// <param name="cropAlias">
|
||||
/// The crop alias e.g. thumbnail
|
||||
/// </param>
|
||||
/// <param name="imageUrlGenerator">The image url generator.</param>
|
||||
/// <param name="mediaItem">The IPublishedContent item.</param>
|
||||
/// <param name="cropAlias">The crop alias e.g. thumbnail.</param>
|
||||
/// <param name="imageUrlGenerator">The image URL generator.</param>
|
||||
/// <param name="publishedValueFallback">The published value fallback.</param>
|
||||
/// <param name="publishedUrlProvider">The published url provider.</param>
|
||||
/// <param name="publishedUrlProvider">The published URL provider.</param>
|
||||
/// <returns>
|
||||
/// The URL of the cropped image.
|
||||
/// </returns>
|
||||
@@ -32,20 +28,14 @@ namespace Umbraco.Extensions
|
||||
string cropAlias,
|
||||
IImageUrlGenerator imageUrlGenerator,
|
||||
IPublishedValueFallback publishedValueFallback,
|
||||
IPublishedUrlProvider publishedUrlProvider)
|
||||
{
|
||||
return mediaItem.GetCropUrl(imageUrlGenerator, publishedValueFallback, publishedUrlProvider, cropAlias: cropAlias, useCropDimensions: true);
|
||||
}
|
||||
IPublishedUrlProvider publishedUrlProvider) => mediaItem.GetCropUrl(imageUrlGenerator, publishedValueFallback, publishedUrlProvider, cropAlias: cropAlias, useCropDimensions: true);
|
||||
|
||||
public static string GetCropUrl(
|
||||
this MediaWithCrops mediaWithCrops,
|
||||
string cropAlias,
|
||||
IImageUrlGenerator imageUrlGenerator,
|
||||
IPublishedValueFallback publishedValueFallback,
|
||||
IPublishedUrlProvider publishedUrlProvider)
|
||||
{
|
||||
return mediaWithCrops.GetCropUrl(imageUrlGenerator, publishedValueFallback, publishedUrlProvider, cropAlias: cropAlias, useCropDimensions: true);
|
||||
}
|
||||
IPublishedUrlProvider publishedUrlProvider) => mediaWithCrops.GetCropUrl(imageUrlGenerator, publishedValueFallback, publishedUrlProvider, cropAlias: cropAlias, useCropDimensions: true);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the crop URL by using only the specified <paramref name="imageCropperValue" />.
|
||||
@@ -54,6 +44,8 @@ namespace Umbraco.Extensions
|
||||
/// <param name="imageCropperValue">The image cropper value.</param>
|
||||
/// <param name="cropAlias">The crop alias.</param>
|
||||
/// <param name="imageUrlGenerator">The image URL generator.</param>
|
||||
/// <param name="publishedValueFallback">The published value fallback.</param>
|
||||
/// <param name="publishedUrlProvider">The published URL provider.</param>
|
||||
/// <returns>
|
||||
/// The image crop URL.
|
||||
/// </returns>
|
||||
@@ -63,26 +55,17 @@ namespace Umbraco.Extensions
|
||||
string cropAlias,
|
||||
IImageUrlGenerator imageUrlGenerator,
|
||||
IPublishedValueFallback publishedValueFallback,
|
||||
IPublishedUrlProvider publishedUrlProvider)
|
||||
{
|
||||
return mediaItem.GetCropUrl(imageUrlGenerator, publishedValueFallback, publishedUrlProvider, imageCropperValue, true, cropAlias: cropAlias, useCropDimensions: true);
|
||||
}
|
||||
IPublishedUrlProvider publishedUrlProvider) => mediaItem.GetCropUrl(imageUrlGenerator, publishedValueFallback, publishedUrlProvider, imageCropperValue, true, cropAlias: cropAlias, useCropDimensions: true);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the underlying image processing service URL by the crop alias using the specified property containing the image cropper Json data on the IPublishedContent item.
|
||||
/// Gets the underlying image processing service URL by the crop alias using the specified property containing the image cropper JSON data on the IPublishedContent item.
|
||||
/// </summary>
|
||||
/// <param name="mediaItem">
|
||||
/// The IPublishedContent item.
|
||||
/// </param>
|
||||
/// <param name="propertyAlias">
|
||||
/// The property alias of the property containing the Json data e.g. umbracoFile
|
||||
/// </param>
|
||||
/// <param name="cropAlias">
|
||||
/// The crop alias e.g. thumbnail
|
||||
/// </param>
|
||||
/// <param name="imageUrlGenerator">The image url generator.</param>
|
||||
/// <param name="mediaItem">The IPublishedContent item.</param>
|
||||
/// <param name="propertyAlias">The property alias of the property containing the JSON data e.g. umbracoFile.</param>
|
||||
/// <param name="cropAlias">The crop alias e.g. thumbnail.</param>
|
||||
/// <param name="imageUrlGenerator">The image URL generator.</param>
|
||||
/// <param name="publishedValueFallback">The published value fallback.</param>
|
||||
/// <param name="publishedUrlProvider">The published url provider.</param>
|
||||
/// <param name="publishedUrlProvider">The published URL provider.</param>
|
||||
/// <returns>
|
||||
/// The URL of the cropped image.
|
||||
/// </returns>
|
||||
@@ -92,74 +75,37 @@ namespace Umbraco.Extensions
|
||||
string cropAlias,
|
||||
IImageUrlGenerator imageUrlGenerator,
|
||||
IPublishedValueFallback publishedValueFallback,
|
||||
IPublishedUrlProvider publishedUrlProvider)
|
||||
{
|
||||
return mediaItem.GetCropUrl( imageUrlGenerator, publishedValueFallback, publishedUrlProvider, propertyAlias: propertyAlias, cropAlias: cropAlias, useCropDimensions: true);
|
||||
}
|
||||
IPublishedUrlProvider publishedUrlProvider) => mediaItem.GetCropUrl(imageUrlGenerator, publishedValueFallback, publishedUrlProvider, propertyAlias: propertyAlias, cropAlias: cropAlias, useCropDimensions: true);
|
||||
|
||||
public static string GetCropUrl(this MediaWithCrops mediaWithCrops,
|
||||
IPublishedValueFallback publishedValueFallback,
|
||||
IPublishedUrlProvider publishedUrlProvider,
|
||||
string propertyAlias,
|
||||
string cropAlias,
|
||||
IImageUrlGenerator imageUrlGenerator)
|
||||
{
|
||||
return mediaWithCrops.GetCropUrl(imageUrlGenerator, publishedValueFallback, publishedUrlProvider, propertyAlias: propertyAlias, cropAlias: cropAlias, useCropDimensions: true);
|
||||
}
|
||||
IImageUrlGenerator imageUrlGenerator) => mediaWithCrops.GetCropUrl(imageUrlGenerator, publishedValueFallback, publishedUrlProvider, propertyAlias: propertyAlias, cropAlias: cropAlias, useCropDimensions: true);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the underlying image processing service URL from the IPublishedContent item.
|
||||
/// </summary>
|
||||
/// <param name="mediaItem">
|
||||
/// The IPublishedContent item.
|
||||
/// </param>
|
||||
/// <param name="imageUrlGenerator">The image url generator.</param>
|
||||
/// <param name="mediaItem">The IPublishedContent item.</param>
|
||||
/// <param name="imageUrlGenerator">The image URL generator.</param>
|
||||
/// <param name="publishedValueFallback">The published value fallback.</param>
|
||||
/// <param name="publishedUrlProvider">The published url provider.</param>
|
||||
/// <param name="width">
|
||||
/// The width of the output image.
|
||||
/// </param>
|
||||
/// <param name="height">
|
||||
/// The height of the output image.
|
||||
/// </param>
|
||||
/// <param name="propertyAlias">
|
||||
/// Property alias of the property containing the Json data.
|
||||
/// </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
|
||||
/// </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="cacheBuster">
|
||||
/// Add a serialized 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[
|
||||
/// <param name="publishedUrlProvider">The published URL provider.</param>
|
||||
/// <param name="width">The width of the output image.</param>
|
||||
/// <param name="height">The height of the output image.</param>
|
||||
/// <param name="propertyAlias">Property alias of the property containing the JSON data.</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.</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="cacheBuster">Add a serialized 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>
|
||||
/// ]]></example></param>
|
||||
/// <param name="ratioMode">Use a dimension as a ratio.</param>
|
||||
/// <returns>
|
||||
/// The URL of the cropped image.
|
||||
/// </returns>
|
||||
@@ -179,11 +125,7 @@ namespace Umbraco.Extensions
|
||||
bool useCropDimensions = false,
|
||||
bool cacheBuster = true,
|
||||
string furtherOptions = null,
|
||||
ImageCropRatioMode? ratioMode = null,
|
||||
bool upScale = true)
|
||||
{
|
||||
return mediaItem.GetCropUrl(imageUrlGenerator, publishedValueFallback, publishedUrlProvider, null, false, width, height, propertyAlias, cropAlias, quality, imageCropMode, imageCropAnchor, preferFocalPoint, useCropDimensions, cacheBuster, furtherOptions, ratioMode, upScale);
|
||||
}
|
||||
ImageCropRatioMode? ratioMode = null) => mediaItem.GetCropUrl(imageUrlGenerator, publishedValueFallback, publishedUrlProvider, null, false, width, height, propertyAlias, cropAlias, quality, imageCropMode, imageCropAnchor, preferFocalPoint, useCropDimensions, cacheBuster, furtherOptions, ratioMode);
|
||||
|
||||
public static string GetCropUrl(
|
||||
this MediaWithCrops mediaWithCrops,
|
||||
@@ -201,12 +143,14 @@ namespace Umbraco.Extensions
|
||||
bool useCropDimensions = false,
|
||||
bool cacheBuster = true,
|
||||
string furtherOptions = null,
|
||||
ImageCropRatioMode? ratioMode = null,
|
||||
bool upScale = true)
|
||||
ImageCropRatioMode? ratioMode = null)
|
||||
{
|
||||
if (mediaWithCrops == null) throw new ArgumentNullException(nameof(mediaWithCrops));
|
||||
if (mediaWithCrops == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(mediaWithCrops));
|
||||
}
|
||||
|
||||
return mediaWithCrops.Content.GetCropUrl(imageUrlGenerator, publishedValueFallback, publishedUrlProvider, mediaWithCrops.LocalCrops, false, width, height, propertyAlias, cropAlias, quality, imageCropMode, imageCropAnchor, preferFocalPoint, useCropDimensions, cacheBuster, furtherOptions, ratioMode, upScale);
|
||||
return mediaWithCrops.Content.GetCropUrl(imageUrlGenerator, publishedValueFallback, publishedUrlProvider, mediaWithCrops.LocalCrops, false, width, height, propertyAlias, cropAlias, quality, imageCropMode, imageCropAnchor, preferFocalPoint, useCropDimensions, cacheBuster, furtherOptions, ratioMode);
|
||||
}
|
||||
|
||||
private static string GetCropUrl(
|
||||
@@ -227,15 +171,17 @@ namespace Umbraco.Extensions
|
||||
bool useCropDimensions = false,
|
||||
bool cacheBuster = true,
|
||||
string furtherOptions = null,
|
||||
ImageCropRatioMode? ratioMode = null,
|
||||
bool upScale = true)
|
||||
ImageCropRatioMode? ratioMode = null)
|
||||
{
|
||||
if (mediaItem == null) throw new ArgumentNullException(nameof(mediaItem));
|
||||
|
||||
var cacheBusterValue = cacheBuster ? mediaItem.UpdateDate.ToFileTimeUtc().ToString(CultureInfo.InvariantCulture) : null;
|
||||
if (mediaItem == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(mediaItem));
|
||||
}
|
||||
|
||||
if (mediaItem.HasProperty(propertyAlias) == false || mediaItem.HasValue(propertyAlias) == false)
|
||||
return string.Empty;
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var mediaItemUrl = mediaItem.MediaUrl(publishedUrlProvider, propertyAlias: propertyAlias);
|
||||
|
||||
@@ -269,63 +215,35 @@ namespace Umbraco.Extensions
|
||||
}
|
||||
}
|
||||
|
||||
var cacheBusterValue = cacheBuster ? mediaItem.UpdateDate.ToFileTimeUtc().ToString(CultureInfo.InvariantCulture) : null;
|
||||
|
||||
return GetCropUrl(
|
||||
mediaItemUrl, imageUrlGenerator, localCrops, width, height, cropAlias, quality, imageCropMode, imageCropAnchor, preferFocalPoint, useCropDimensions,
|
||||
cacheBusterValue, furtherOptions, ratioMode, upScale);
|
||||
cacheBusterValue, furtherOptions, ratioMode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the underlying image processing service URL from the image path.
|
||||
/// </summary>
|
||||
/// <param name="imageUrl">
|
||||
/// The image URL.
|
||||
/// </param>
|
||||
/// <param name="width">
|
||||
/// The width of the output image.
|
||||
/// </param>
|
||||
/// <param name="height">
|
||||
/// The height of the output image.
|
||||
/// </param>
|
||||
/// <param name="imageCropperValue">
|
||||
/// The Json data from the Umbraco Core Image Cropper property editor
|
||||
/// </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 serialized 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 the underlying image processing service supports. For example:
|
||||
/// <example>
|
||||
/// <![CDATA[
|
||||
/// <param name="imageUrl">The image URL.</param>
|
||||
/// <param name="imageUrlGenerator">The image URL generator.</param>
|
||||
/// <param name="width">The width of the output image.</param>
|
||||
/// <param name="height">The height of the output image.</param>
|
||||
/// <param name="imageCropperValue">The Json data from the Umbraco Core Image Cropper property editor.</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 serialized 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 the underlying image processing service 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>
|
||||
/// ]]></example></param>
|
||||
/// <param name="ratioMode">Use a dimension as a ratio.</param>
|
||||
/// <returns>
|
||||
/// The the URL of the cropped image.
|
||||
/// The URL of the cropped image.
|
||||
/// </returns>
|
||||
public static string GetCropUrl(
|
||||
this string imageUrl,
|
||||
@@ -341,10 +259,12 @@ namespace Umbraco.Extensions
|
||||
bool useCropDimensions = false,
|
||||
string cacheBusterValue = null,
|
||||
string furtherOptions = null,
|
||||
ImageCropRatioMode? ratioMode = null,
|
||||
bool upScale = true)
|
||||
ImageCropRatioMode? ratioMode = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(imageUrl)) return string.Empty;
|
||||
if (string.IsNullOrWhiteSpace(imageUrl))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
ImageCropperValue cropDataSet = null;
|
||||
if (string.IsNullOrEmpty(imageCropperValue) == false && imageCropperValue.DetectIsJson() && (imageCropMode == ImageCropMode.Crop || imageCropMode == null))
|
||||
@@ -354,62 +274,31 @@ namespace Umbraco.Extensions
|
||||
|
||||
return GetCropUrl(
|
||||
imageUrl, imageUrlGenerator, cropDataSet, width, height, cropAlias, quality, imageCropMode,
|
||||
imageCropAnchor, preferFocalPoint, useCropDimensions, cacheBusterValue, furtherOptions, ratioMode, upScale);
|
||||
imageCropAnchor, preferFocalPoint, useCropDimensions, cacheBusterValue, furtherOptions, ratioMode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the underlying image processing service URL from the image path.
|
||||
/// </summary>
|
||||
/// <param name="imageUrl">
|
||||
/// The image URL.
|
||||
/// </param>
|
||||
/// <param name="imageUrlGenerator">
|
||||
/// The generator that will process all the options and the image URL to return a full image URLs with all processing options appended
|
||||
/// </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 serialized 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 the underlying image processing service supports. For example:
|
||||
/// <example>
|
||||
/// <![CDATA[
|
||||
/// <param name="imageUrl">The image URL.</param>
|
||||
/// <param name="imageUrlGenerator">The generator that will process all the options and the image URL to return a full image URLs with all processing options appended.</param>
|
||||
/// <param name="cropDataSet">The crop data set.</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 serialized 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 the underlying image processing service 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>
|
||||
/// ]]></example></param>
|
||||
/// <param name="ratioMode">Use a dimension as a ratio.</param>
|
||||
/// <returns>
|
||||
/// The <see cref="string"/>.
|
||||
/// The URL of the cropped image.
|
||||
/// </returns>
|
||||
public static string GetCropUrl(
|
||||
this string imageUrl,
|
||||
@@ -425,21 +314,23 @@ namespace Umbraco.Extensions
|
||||
bool useCropDimensions = false,
|
||||
string cacheBusterValue = null,
|
||||
string furtherOptions = null,
|
||||
ImageCropRatioMode? ratioMode = null,
|
||||
bool upScale = true,
|
||||
string animationProcessMode = null)
|
||||
ImageCropRatioMode? ratioMode = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(imageUrl)) return string.Empty;
|
||||
if (string.IsNullOrWhiteSpace(imageUrl))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
ImageUrlGenerationOptions options;
|
||||
|
||||
if (cropDataSet != null && (imageCropMode == ImageCropMode.Crop || imageCropMode == null))
|
||||
{
|
||||
var crop = cropDataSet.GetCrop(cropAlias);
|
||||
|
||||
// if a crop was specified, but not found, return null
|
||||
// If a crop was specified, but not found, return null
|
||||
if (crop == null && !string.IsNullOrWhiteSpace(cropAlias))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
options = cropDataSet.GetCropBaseOptions(imageUrl, crop, string.IsNullOrWhiteSpace(cropAlias), preferFocalPoint);
|
||||
|
||||
@@ -464,7 +355,7 @@ namespace Umbraco.Extensions
|
||||
}
|
||||
else
|
||||
{
|
||||
options = new ImageUrlGenerationOptions (imageUrl)
|
||||
options = new ImageUrlGenerationOptions(imageUrl)
|
||||
{
|
||||
ImageCropMode = (imageCropMode ?? ImageCropMode.Pad),
|
||||
ImageCropAnchor = imageCropAnchor
|
||||
@@ -474,7 +365,6 @@ namespace Umbraco.Extensions
|
||||
options.Quality = quality;
|
||||
options.Width = ratioMode != null && ratioMode.Value == ImageCropRatioMode.Width ? null : width;
|
||||
options.Height = ratioMode != null && ratioMode.Value == ImageCropRatioMode.Height ? null : height;
|
||||
options.AnimationProcessMode = animationProcessMode;
|
||||
|
||||
if (ratioMode == ImageCropRatioMode.Width && height != null)
|
||||
{
|
||||
@@ -502,7 +392,6 @@ namespace Umbraco.Extensions
|
||||
}
|
||||
}
|
||||
|
||||
options.UpScale = upScale;
|
||||
options.FurtherOptions = furtherOptions;
|
||||
options.CacheBusterValue = cacheBusterValue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user