However i can't work out how to use the GetCropUrl when it's included on this razor macro which displays2 news stories. I want to get the crop url on this @page.newsThumbnailImage2 in the razor code below.
Can anyone help. Thanks
@inherits umbraco.MacroEngines.DynamicNodeContext
@{
var newsItems = Model.NodeById(1075);
var sortedItems = newsItems.Children.OrderBy("createDate descending").Take(2);
Use GetCropUrl in new itesm
Hi,
What i want to do is use a thumbnail image for my new stories on my homepage. It works when the data type alias is on the page i.e
<img src='@CurrentPage.GetCropUrl("solution1Image", "SolutionsImageCropper")' />
However i can't work out how to use the GetCropUrl when it's included on this razor macro which displays2 news stories. I want to get the crop url on this @page.newsThumbnailImage2 in the razor code below.
Can anyone help. Thanks
@inherits umbraco.MacroEngines.DynamicNodeContext
@{
var newsItems = Model.NodeById(1075);
var sortedItems = newsItems.Children.OrderBy("createDate descending").Take(2);
foreach(var page in sortedItems.Where("visible"))
{
<p>@page.newsThumbnailImage2</p>
}
}
Hi Alan
I think that it should work if you write this
Does this work?
/Jan
Thanks Jan, it comes back with an error message though:
Too many characters in character literal
Thanks Jan, nothing coming back though
Hi Alan,
You cannot use GetCropUrl in a legacy macro Razor script (DynamicNode).
You need to use it in a View, Partial View or a Partial View Macro.
Jeavon
is working on a reply...