GetCropUrl returns null with valid cropAlias param V8
See original GitHub issueBug 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:
- Created 4 years ago
- Comments:22 (20 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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.
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("")
.