HI,
I am upgrading to Umbraco 8.15 and trying to use the new Media Oicker 3 with crops, like a crop with an alias of blogPost.
I can select the image and I cannot get it to display the specific crop.
I have even been through the documentation page here: Media-Picker-3 - built-in-property-editors - property-editors - Backoffice - Fundamentals - Documentation - our.umbraco.com
Here is my code, please can someone shed some light on getting to the crop for me please.
foreach (var post in Model.Posts) {
@if (post.HasValue("postMediaImage")) {
dynamic mediaItem = post.GetProperty("postMediaImage").Value() as Umbraco.Core.Models.PublishedContent.IPublishedContent;
var t = mediaItem.LocalCrops;
<div class="postthumb" style="background: url(@t)"></div>
}
}
The above gets my image displayed, but no crop version.
The images use new media Picker 3, and have a crop blogPost. So I am iterating down a list of entries, trying to display a thumbnail of the image for the main post.
the examples in the documentation do not seem to work:
@{
foreach (var entry in Model.Medias)
{
<img src=“@entry.GetLocalCropUrl(“cropAlias”)”/>
}
}
I cannot seem to replace the Model.Media bit with my post to get to the image and be able to use the GetLocalCropUrl helper.
Thank you in advance for your help.
Kind regards,
Pete
This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/106686-getting-crops-from-new-media-picker-3