Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I see that you're using the image cropper for an Author Image, but if I add a crop to it, I don't see a way in the strongy typed model to then pull the crop of the image rather than just the default image itself. How do I go about doing that?
The PostModel and all other articulate models implement IPublishedContent, so you have direct access to all the normal ways of working with Umbraco data as well. So you can still do @Model.Content.GetPropertyValue ....
I can add a nicer way of doing it to the strongly typed model though if you want to create an issue for it?
Well, in an ideal world full of unicorns and rainbows, I would want something like this: https://github.com/rustyswayne/Buzz.Hybrid/blob/master/src/Buzz.Hybrid/ImageExtensions.cs
In the meantime, I'll submit an issue for it and just use IPublishedContent ;) Thanks for clarifying!
Pretty sure your world of unicorns and rainbows already exists, no?
Right, but that's off IPublisheContent and not a strongly typed image, isn't it?
(You'll have to forgive me, I'm jumping into this with a learning curb as we just started doing a Hybrid Framework for everything here)
Yup, so the underlying call to populate Articulate's AuthorModel is:
public AuthorModel Author
if (_author != null)
_author = new AuthorModel
Name = Content.GetPropertyValue<string>("author", true)
//look up assocated author node if we can
if (RootBlogNode != null)
var authors = RootBlogNode.Children(content => content.DocumentTypeAlias.InvariantEquals("ArticulateAuthors")).FirstOrDefault();
if (authors != null)
var authorNode = authors.Children(content => content.Name.InvariantEquals(_author.Name)).FirstOrDefault();
if (authorNode != null)
_author.Bio = authorNode.GetPropertyValue<string>("authorBio");
_author.Url = authorNode.GetPropertyValue<string>("authorUrl");
_author.Image = authorNode.GetCropUrl(propertyAlias: "authorImage", imageCropMode: ImageCropMode.Max);
So until I add something nicer, you can create your own extension method on PostModel like :
public static class PostModelExtensions
public static string GetAuthorCropUrl(this PostModel postModel)
if (postModel.RootBlogNode == null) return string.Empty;
var authors = postModel.RootBlogNode.Children(content => content.DocumentTypeAlias.InvariantEquals("ArticulateAuthors")).FirstOrDefault();
if (authors == null) return string.Empty;
var authorNode = authors.Children(content => content.Name.InvariantEquals(postModel.Author.Name)).FirstOrDefault();
return authorNode != null
//TODO: Adjust the overloaded parameters to suit your needs here:
? authorNode.GetCropUrl(propertyAlias: "authorImage", imageCropMode: ImageCropMode.Max)
Genius! Thank you so much for the help :)
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted