Skip to content

Commit

Permalink
Fixes #10402 - GetCropUrl Url extension has duplicate signatures and …
Browse files Browse the repository at this point in the history
…results in error

This is a breaking change for people using `GetCropUrl` to get local crops from the media picker v3. In order to disambiguate the extension method an make  it a bit clearer what it does, I propose the method name change, after which there is no need to have the first argument being the local crops, but it can be the whole MediaWithCrops object, since the method name already makes clear you're not trying to get the global crops.
  • Loading branch information
nul800sebastiaan committed Jun 24, 2021
1 parent 56b7b0d commit aeda66d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Umbraco.Web/UrlHelperRenderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Web;
using System.Web.Mvc;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.PropertyEditors.ValueConverters;
using Umbraco.Web.Composing;
Expand Down Expand Up @@ -262,8 +263,8 @@ public static IHtmlString GetCropUrl(this UrlHelper urlHelper,
return htmlEncode ? new HtmlString(HttpUtility.HtmlEncode(url)) : new HtmlString(url);
}

public static IHtmlString GetCropUrl(this UrlHelper urlHelper,
ImageCropperValue imageCropperValue,
public static IHtmlString GetLocalCropUrl(this UrlHelper urlHelper,
MediaWithCrops mediaWithCrops,
string cropAlias,
int? width = null,
int? height = null,
Expand All @@ -278,6 +279,7 @@ public static IHtmlString GetCropUrl(this UrlHelper urlHelper,
bool upScale = true,
bool htmlEncode = true)
{
var imageCropperValue = mediaWithCrops.LocalCrops;
if (imageCropperValue == null) return EmptyHtmlString;

var imageUrl = imageCropperValue.Src;
Expand Down

0 comments on commit aeda66d

Please sign in to comment.