Copied to clipboard

Flag this post as spam?

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


  • Kate 267 posts 610 karma points
    Feb 27, 2016 @ 12:08
    Kate
    0

    inherited an images from frontpage

    Hi

    I have an images on my frontpage that I would like to display on my subpages. I have done it with simple text-strings but I can't get it to work with an images.

    This is how I have done it with a text-string in the PartialViewMacroPage

    @Model.Content.AncestorOrSelf(1).GetPropertyValue("email")
    

    I appreciate your help :-)

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Feb 27, 2016 @ 12:21
    Jeavon Leopold
    0

    Hi Kate,

    Do you have a media picker on your homepage that you wish to show on every page?

    Jeavon

  • Kate 267 posts 610 karma points
    Feb 27, 2016 @ 12:46
    Kate
    0

    Yes. I use a Media Picker

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Feb 27, 2016 @ 13:09
    Jeavon Leopold
    100

    Ok then, should be like this:

    @{
        var mediaItemId = Model.Content.AncestorOrSelf(1).GetPropertyValue<int>("mediaPickerAlias");
        var mediaItem = Umbraco.TypedMedia(mediaItemId);
    }
    <img src="@mediaItem.Url"/>
    
  • Kate 267 posts 610 karma points
    Feb 27, 2016 @ 13:20
    Kate
    0

    Thank you :-) Just what i need

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Feb 27, 2016 @ 13:35
    Jeavon Leopold
    0

    You're welcome

  • 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