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
The code below used to work on a few of my previous Umbraco sites with Leblender and now I am seeing an error. What am I missing?
@inherits UmbracoViewPage<Lecoati.LeBlender.Extension.Models.LeBlenderModel> @{ Layout = ""; var header = Model.Items.ElementAt(0); var image = String.IsNullOrEmpty(header.GetValue<string>("Image")) ? "#" : Umbraco.TypedMedia(header.GetValue<string>("Image")).Url; var link = Umbraco.Content( @Model.Items.ElementAt(0).GetValue("link") ); } @if ( @link.Url == "" ) { <img class='img-responsive @Html.Raw(Model.Items.ElementAt(0).GetValue("class"))' src="@image" data-aos='@Html.Raw(Model.Items.ElementAt(0).GetValue("animationDirection"))' alt='@Html.Raw(Model.Items.ElementAt(0).GetValue("altText"))'> } else { <a href="@link.Url"> <img class='img-responsive @Html.Raw(Model.Items.ElementAt(0).GetValue("class"))' src="@image" data-aos='@Html.Raw(Model.Items.ElementAt(0).GetValue("animationDirection"))' alt='@Html.Raw(Model.Items.ElementAt(0).GetValue("altText"))'></a> }
I have also tried the example in the leblender documentation.
@foreach(variteminModel.Items) { <div> <imgsrc="@Umbraco.TypedMedia(item.GetValue<string>("image")).Url"/> <h3>@item.GetValue("title")</h3> <p>@item.GetValue("summary")</p> <p><ahref="@Umbraco.TypedContent(item.GetValue<string>("link")).Url">Learnmore</a> </p> </div>}
Hi Mov3nforward
Don't you need to pass an int into the @Umbraco.TypedMedia() function ?
Try :
<img src="@Umbraco.TypedMedia(item.GetValue<int>("image")).Url"/>
If that does not work. Can you debug the value(i.e item.GetValue
Hope this helps.
Hi,
item.GetValue("image") contanins this string = "Umbraco.Core.Udi[]"
Try passing the Id like this:
<img src="@Umbraco.TypedMedia(item.GetValue<IPublishedContent>("image").Id).Url"/>
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Issue with using media picker
The code below used to work on a few of my previous Umbraco sites with Leblender and now I am seeing an error. What am I missing?
I have also tried the example in the leblender documentation.
Hi Mov3nforward
Don't you need to pass an int into the @Umbraco.TypedMedia() function ?
Try :
If that does not work. Can you debug the value(i.e item.GetValue
Hope this helps.
Hi,
item.GetValue("image") contanins this string = "Umbraco.Core.Udi[]"
Try passing the Id like this:
is working on a reply...