U4-9942 - GetCropUrl does not use the focal point of the media, and frequently doesn't provide a url

Created by John Bergman 22 May 2017, 19:17:08 Updated by John Bergman 24 May 2017, 16:20:01

I went back add added crop aliases to the media library; I can see them when I look at the media item, and they are responsive based on the focal point. However, I have been unable to determine the magical incantation to fetch the crop with the focal point. It appears to use the ImageCropAnchor no matter what. The name of my crop setting is "masthead" Here are some of the incantations that do not work (keep in mind there was experimentation going on, so the code is not optimal): var tmp = mastHead.mastheadImage.First(); var mediaItem = Umbraco.TypedMedia(tmp.Id); mastHeadImageUrl = Url.GetCropUrl(mediaItem, "masthead").ToString(); mastHeadImageUrl = mastHead.mastheadImage.First().GetCropUrl(cropAlias:"masthead"); mastHeadImageUrl = mastHead.mastheadImage.First().GetCropUrl(cropAlias: "masthead", preferFocalPoint: true); mastHeadImageUrl = mastHead.mastheadImage.First().GetCropUrl(propertyAlias: "umbracoFile", cropAlias: "masthead"); The image is selected using the media picker, and the actual image resides in the media library. If I try to use the GetCropUrl on the document, (called masthead) like this: mastHeadImageUrl = mastHead.GetCropUrl("mastheadImage", "masthead").ToString(); I receive "1985?mode=pad&rnd=131394550750000000" 1985 is the MediaId of the image.

There are several posts in the forum relating to the same issue,. https://our.umbraco.org/forum/using-umbraco-and-getting-started/85779-perplexed-by-getcropurl-in-76 https://our.umbraco.org/forum/using-umbraco-and-getting-started/85827-image-crops-not-working-761

I know this is in 7.6.1 (and 7.6), I am not sure if the problem also exists in 7.5.x

(Sorry for the update, I had an incorrect method in the title)

Comments

David Pearcey 23 May 2017, 11:42:25

@john.bergman@xpdnt.com One of those posts was mine. The problem didn't exist for me in 7.5.x before updating to 7.6.1. It appears to be an issue communicating with the CDN for the crops. It's even breaking for me in the back office, not loading in the thumbnails within the media section (They eventually load the full image instead).

This has only been an issue since upgrading from 7.5.x - 7.6.1. It all worked without any issue amongst several versions of 7.5


Priority: Major

Type: Bug

State: Submitted

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 7.6.1

Due in version:

Sprint:

Story Points:

Cycle: