(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.
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?
@Url.GetCropUrl......
I obviously lack a basic bit of understanding of this method...
This works:
(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
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.
Hi Ault
What if you have?
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?
regards
Marc
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...