Copied to clipboard

Flag this post as spam?

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


  • Rocoeh 65 posts 86 karma points
    Mar 20, 2012 @ 10:27
    Rocoeh
    0

    Output the image from ultimate picker

    Hi,

     

    There seems to be lots if info on how to do this in xslt, however if I select an image with media  picker the the page outputs the id (1193), how can I get the iamge from the id using razor.

     <umbraco:Item field="ultimate" runat="server" />

  • Rocoeh 65 posts 86 karma points
    Mar 20, 2012 @ 11:06
    Rocoeh
    0

    So I can get the image output using media picker using the following

    <umbraco:Macro runat="server" language="cshtml">
      <img src="@Model.MediaById(@Model.mediaPicker).umbracoFile" />
    </umbraco:Macro>


     <umbraco:Item field="mediaPicker" runat="server" /> // outputs an id
      <umbraco:Item field="filePicker" runat="server" /> // ouputs a url

     


    - is there a  way to get the height and width with mediaPicker?

    - is there a razor function like @Model.MediaByUrl or another way to render the image from the url?

    Thanks

  • Rodion Novoselov 694 posts 859 karma points
    Mar 20, 2012 @ 11:08
    Rodion Novoselov
    0

    Hi. The Library.MediaById is what you need. It returns a dynamically-casted instance of the DynamicMedia class that behaves like DynamicNode. (I.e. you can just call UmbracoFile, UmbracoWidth/Height, etc on it).

Please Sign in or register to post replies

Write your reply to:

Draft