Umbraco-CMS: GetCropUrl returns null with valid cropAlias param V8

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.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 22 (20 by maintainers)

Most upvoted comments

@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