Copied to clipboard

Flag this post as spam?

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


  • Mike Poole 53 posts 165 karma points
    Sep 28, 2018 @ 18:43
    Mike Poole
    0

    Umbraco.Media URL not being returned

    I have recently upgraded to 7.10.5

    On my dev environment, I use the following to get the URL of a media picker property and it works successfully

    var logoUrl = Umbraco.Media(Model.Brand.GetPropertyValue("logoHomePage")).Url;
    

    And then

    <img src="@logoUrl" alt="@siteTitle" />
    

    On my deployed environment, I am getting src(unknown) - when I debug, the Model.Brand.GetPropertyValue("logoHomePage") is returning the correct ID but URL is returning nothing. No errors in the browser or the logs

    EnablePropertyValueConverters is set to false on both environments

    What would be stopping the URL beign returned?

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Sep 29, 2018 @ 21:59
    Alex Skrypnyk
    0

    Hi Mike

    Try to use strongly typed medias like that:

    var logoUrl = Umbraco.TypedMedia(Model.Brand.GetPropertyValue("logoHomePage")).Url;
    
  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Oct 16, 2018 @ 13:48
    Alex Skrypnyk
    0

    Hi Mike

    Did you solve the issue?

    Oleksandr

Please Sign in or register to post replies

Write your reply to:

Draft