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 have a Testimonial us Nested Content. for some reason i cannot get the image.
var items = Model.GetPropertyValue<IEnumerable<IPublishedContent>> ("testimonial"); foreach (var item in items) { /*var typedMediaPickerSingle = Model.GetPropertyValue.<IPublishedContent>("image");*/ var image = item.GetPropertyValue<IPublishedContent>("image"); if (item.HasValue("image")) { <h2>@item.GetPropertyValue("testimonialName")</h2> <img src="@image.Url" style="width:200px" alt="@item.Name" /> <h3>@item.GetPropertyValue("location")</h3> <h4>@item.GetPropertyValue("quote")</h4> } }
I get all properties but the image. I have tried all documentation for media picker with errors .
Hi Keith,
What does the url point to ? Do you get a url ? Because it seems to find a image.
Dave
I followed Jeavon's direction some time ago and set the image media type to umbracoFile Alias. I am thinking this may have something to do with it. I am using the Media Picker with Multiple images disabled.
/*var typedMediaPickerSingle = Model.GetPropertyValue<IPublishedContent>("image");*/ /*var image = Umbraco.TypedMedia(@item.GetPropertyValue("image"));*/ /*var image = item.GetPropertyValue<IPublishedContent>("image");*/ var imageUrl = item.GetPropertyValue<IEnumerable<IPublishedContent>>("testimonialImage"); if (item.HasValue("testimonialImage")) { <div class="col-md-4 col-sm-6 item"> <h2>@item.GetPropertyValue("testimonialName")</h2> <img src="@imageUrl" height="200" width="200" alt="@item.Name" /> <h3>@item.GetPropertyValue("location")</h3> <h4>@item.GetPropertyValue("quote")</h4> </div> }
Here is the latest code. I know that it is reading the items because i get the alt of the image But i get an broken image.
looks like a pretty recent install... is it mediapicker2? https://our.umbraco.org/documentation/getting-started/backoffice/property-editors/built-in-property-editors/Media-Picker2
is any of that helpful?
Bob I tried that but, thanks for trying to help.
I was able to get it working!!!!
foreach (var item in items) { var imageUrl = item.GetPropertyValue<IPublishedContent>("testimonialImage"); if (item != null) { <div class="col-md-4 col-sm-6 item"> <h2>@item.GetPropertyValue("testimonialName")</h2> <img src="@imageUrl.Url" height="200" width="200" alt="@item.Name" /> <h3>@item.GetPropertyValue("location")</h3> <h4>@item.GetPropertyValue("quote")</h4> </div> }
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Getting image to work for IPublishedContent with nested Content
I have a Testimonial us Nested Content. for some reason i cannot get the image.
I get all properties but the image. I have tried all documentation for media picker with errors .
Hi Keith,
What does the url point to ? Do you get a url ? Because it seems to find a image.
Dave
Dave
I followed Jeavon's direction some time ago and set the image media type to umbracoFile Alias. I am thinking this may have something to do with it. I am using the Media Picker with Multiple images disabled.
Here is the latest code. I know that it is reading the items because i get the alt of the image But i get an broken image.
looks like a pretty recent install... is it mediapicker2? https://our.umbraco.org/documentation/getting-started/backoffice/property-editors/built-in-property-editors/Media-Picker2
is any of that helpful?
Bob I tried that but, thanks for trying to help.
I was able to get it working!!!!
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.