Copied to clipboard

Flag this post as spam?

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


  • Moran 285 posts 934 karma points
    Dec 13, 2013 @ 07:47
    Moran
    0

    Getting media name in template

    Hi I am trying to get the media name in the alt attribute of img tag.

    <img 
    src='<umbraco:ItemField="topImage"Xslt="umbraco.library:GetMedia({0},0)/umbracoFile" runat="server" />'
    alt='<umbraco:Item Field="topImage" Xslt="umbraco.library:GetMedia({0},0)/mediaName" runat="server" />'
    title="test"
    class="templateImage" />
    

    I am using umbraco 4.11.8 and the WebForms schema

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Dec 13, 2013 @ 08:00
    Dennis Aaen
    100

    Hi Moran,

    Try this one:

    <img 
    src='
    <umbraco:ItemField="topImage"Xslt="umbraco.library:GetMedia({0},0)/umbracoFile"runat="server"/>'
    alt='
    <umbraco:Item Field="topImage" Xslt="umbraco.library:GetMedia({0},0)/@nodeName"runat="server"/>'
    title="test"
    class="templateImage" />

    That shoud give you the name of the image in the media library.

    I hope this helps you,

    /Dennis

  • Moran 285 posts 934 karma points
    Dec 13, 2013 @ 08:21
    Moran
    0

    Thanks :)

Please Sign in or register to post replies

Write your reply to:

Draft