Copied to clipboard

Flag this post as spam?

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


  • user33 9 posts 56 karma points
    Jan 20, 2016 @ 00:09
    user33
    0

    unable to render an image through archetype properties

    the code I am using is var theImage = @item.GetValue("boxImage");

    @theImage.Name

    but it's rendering just the media number not the image. This code is used in the archetypes not from partialviews or macros.

  • Nathan Woulfe 447 posts 1665 karma points MVP 5x hq c-trib
    Jan 20, 2016 @ 06:17
    Nathan Woulfe
    0

    Content pickers don't store the image URL, they store the media item id - you need to fetch the media item and use the URL property.

    Something like this:

    var imageUrl = Umbraco.Media(item.GetValue("boxImage")).Url;

Please Sign in or register to post replies

Write your reply to:

Draft