Copied to clipboard

Flag this post as spam?

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


  • Darryl Godden 145 posts 197 karma points
    Oct 07, 2011 @ 10:56
    Darryl Godden
    0

    Display Single Image from Property

    Hi all,

    First bit of Razor, well apart from the Level 1 snippet the other day! I'm trying to display an image from a property on a template. The image comes from a Terabyte Image Cropper on the Document Type. So far I have tried:

            <umbraco:Macro runat="server" language="cshtml">
              <img src='@Model.Media("boBFullSizeImageForProfile", "umbracoFile")' alt='@Model.GetProperty("fullName")' />
            </umbraco:Macro>

    Obviously it's not working, or I wouldn't be posting!

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Oct 07, 2011 @ 12:52
    Dirk De Grave
    0

    Darryl,

    there's two things to keep an eye on:

    - umbraco version: implementation may have changed from v4.7 to v4.7.1

    - stored value for a terabyte image cropper

    So, tell us what version of umbraco you're using and secondly, try to find out how data is stored for such a property (Check /App_Data/umbraco.config file). Based on that info, we might find a solution that fits your environment.

     

    Cheers,

    /Dirk

  • Darryl Godden 145 posts 197 karma points
    Oct 07, 2011 @ 13:06
    Darryl Godden
    0

    Thanks for your reply Dirk, here's the info you requested:

    <boBPageVenueFullImage><![CDATA[/media/2838/bob-lg-arena-logo.png]]></boBPageVenueFullImage>

    and the Umbraco version is 4.7.0.

    Thanks.

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Oct 07, 2011 @ 13:51
    Dirk De Grave
    1

    Ok, so the terabyte image cropper is actually used on a document type, right? in that case, you could just output

    <img src="@Model.boBPageVenueFullImage" />

    If it's used on a doc type, only data saved is the full path to the image file, so you won't be able to get a display friendly name for the image.

    (Just realising that the datatype can only be used on doc types, so regardless of the version v4.7 or v4.7.1, implementation remains identical - was a bit confused by your @Model.Media...)

    Cheers,

    /Dirk

  • Darryl Godden 145 posts 197 karma points
    Oct 07, 2011 @ 13:59
    Darryl Godden
    0

    Thanks Dirk!

Please Sign in or register to post replies

Write your reply to:

Draft