Copied to clipboard

Flag this post as spam?

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


  • Jason Denousse 24 posts 93 karma points
    May 23, 2019 @ 15:45
    Jason Denousse
    0

    Convert media 4 digit number to a url using media picker

    When I use the media picker and then put my value into my html img src tag, the output is a 4 digit number.

    How can i convert this into a url so that it will show the image?

  • B. Gunnarsson (Bryns) 25 posts 180 karma points c-trib
    May 23, 2019 @ 16:53
    B. Gunnarsson (Bryns)
    0

    If you are using Umbraco 7 without ModelsBuilder:

    @{
       var image = Model.Content.GetPropertyValue<IPublishedContent>("alias")
       if(image != null) {
        <img src="@image.Url" />
      }
    }
    

    Umbraco 8:

    @{
        var image = Model.Value<IPublishedContent>("alias");
    
        if(image != null) {
          <img src="@image.Url" />
       }
    }
    
Please Sign in or register to post replies

Write your reply to:

Draft