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 obviously lack a basic bit of understanding of this method...
<img src="@Url.GetCropUrl(Model.Content.WtImageBackground, "L")" />
(Where WtImageBackground is the alias of the image and "L" is the crop name.
However, when I call the children of the current page, this does not work
var wtChildren = Model.Content.Children();
foreach (var wtChild in wtChildren)
<img src="@Url.GetCropUrl(wtChild.GetPropertyValue("WtImageBackground"), "L")" />
However, if I only call wtChild.GetPropertyValue("WtImageBackground") I get the numeric reference of the image, much the same as I do with Model.Content.WtImageBackground.
Any thoughts on getting this working or any links to a resource that might give me a thorough understanding of Url.GetCropUrl would be appreciated.
What if you have?
<img src="@Url.GetCropUrl(wtChild.GetPropertyValue<IPublishedContent>("WtImageBackground"), "L")" />
Essentially GetPropertyValue without the <type> , will return an object, which then GetCropUrl won't be expecting...
but think if PropertyValueConverters are enabled, and you specifically say the type is IPublishedContent of your media item, then that might make it work?
Thanks Marc, that did the trick.
I keep thinking that I should be able to do this without IPublishedContent... but I'll let it be for the time being.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted