Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Sonja 132 posts 620 karma points
    Nov 15, 2018 @ 05:53
    Sonja
    1

    Displaying image in Umbraco

    Hi I have image in a nested content and with

    myNestedContentItem.GetProperty("myImg").DataValue
    

    I'm getting

    "umb://media/781a5e051a3e4042bc4f184e968f1b4f"
    

    how do I put this value to get valid html, something that will display the image in

    <img src="~/images/12.jpg">
    

    Thanks

  • Dennis Adolfi 1072 posts 6378 karma points MVP 2x c-trib
    Nov 15, 2018 @ 06:33
    Dennis Adolfi
    100

    Hi Sonja.

    Your property "myImg", what is the datatype? MediaPicker?

    In that case you could try:

    var media = myNestedContentItem.GetPropertyValue<IPublishedContent>("myImg");
    <img src='@media.Url'>
    

    Best of luck to you!

  • 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.

Please Sign in or register to post replies