question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GetCropUrl returns null with valid cropAlias param V8

See original GitHub issue

Bug summary

ImageCropperTemplateExtensions.GetCropUrl returns null when provided a valid cropAlias parameter unless you save each image in your media library after adding a new crop.

Specifics

This occurs in 8.0.2 and v8/dev using Chrome (but should affect all browsers)

Steps to reproduce

  • V8 with SK installed
  • Update Image Media Type -> Update umbracoFile Image Cropper DataType settings to include a crop type (ie square)
  • Update Products.cshtml / template with <img src='@product.Photos.GetCropUrl("square")' />
  • View page on frontend & confirm image renders (they don’t)
  • Goto Media Section & Choose a Product Image
  • Set manual crops for the image
  • View page on frontend & confirm image renders (they do)

Expected result

The images should be rendered. See reproduction for more details.

Actual result

The images are not. See reproduction for more details.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:22 (20 by maintainers)

github_iconTop GitHub Comments

1reaction
cleversolutionscommented, Mar 23, 2020

@rbottema good catch. I continued my test above adding a second crop, and it works as expected. It seems this problem only happens when going from 0 to 1 or more crops.

2020-03-23-10-44-50

0reactions
nul800sebastiaancommented, Jul 27, 2020

Fixed in https://github.com/umbraco/Umbraco-CMS/pull/6950

@thaihoc2 This PR is now merged but it’s not for your issue, I think you have the problem as described in https://github.com/umbraco/Umbraco-CMS/issues/8116 (the short version of this is: try using @Url.GetCropUrl("").

Read more comments on GitHub >

github_iconTop Results From Across the Web

getcropurl returns empty - Umbraco 8
Image is a MediaPicker and I've defined a crop called "Testimonial". ... since the extension with crop alias is not working in Umbraco...
Read more >
Class ImageCropperTemplateExtensions | Umbraco c# Api ...
public static string GetCropUrl(this string imageUrl, int? width = null, ... image using the focal point instead of the predefined crop if there...
Read more >
Umbraco GetCropUrl not giving me a valid URL with Image ...
The first argument should be the alias of the Image cropper property. This is optional and it will look for a property with...
Read more >
C# (CSharp) UmbracoHelper.TypedMedia Examples
Where(x => x != null); } // in v8 should return multiNodeTreePickerEnumerable but for v7 need to return as PublishedContentEnumerable so that string...
Read more >
Untitled
GetCropUrl returns null with valid cropAlias param V8 #5737 - GitHub Web14 nov. 2017 · The first parameter of Url.GetCropUrl() needs to be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found