Copied to clipboard

Flag this post as spam?

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


  • Jack Ward 3 posts 73 karma points
    Jan 27, 2016 @ 16:14
    Jack Ward
    0

    Unable to use Url property of Media files

    Not sure if this was intentional but it doesn't mention it in the documentation but the Url property is being returned as null for images gotten as follows:

    @var logo = CurrentPage._JenisonLogo;
    @var logoCollection = Umbraco.Media(logo);
    <img src="@logoCollection.Url" alt="Jenison" />
    

    I needed to get this image in the old-way as I'm not sure I understand the use of PropertyAlias in Umbraco yet and passing it as null when trying to force type to 'png' to retain transparency fails as well.

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Jan 27, 2016 @ 17:23
    Dennis Aaen
    1

    Hi Jack and welcome to our :-)

    First try to add @{} around your code block and then remove the @ before your variables.

    The next thing is try change Url to umbracoFile in the image tag

    Hope this helps,

    /Dennis

  • Jack Ward 3 posts 73 karma points
    Jan 28, 2016 @ 09:37
    Jack Ward
    0

    That seems to have worked, thanks.

    Is there no way to create a responsive image in a 'png' format without an alias?

Please Sign in or register to post replies

Write your reply to:

Draft