Copied to clipboard

Flag this post as spam?

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


  • Claire Botman 48 posts 77 karma points
    Jul 17, 2010 @ 02:32
    Claire Botman
    0

    Wiki reference to altText for GetMedia in version 4.5

    I was having trouble rendering an image in my new 4.5 site and found this wiki - http://our.umbraco.org/wiki/reference/umbracolibrary/getmedia

    It has a reference at the end to altText, like so:

    <xsl:variable name="media" select="umbraco.library:GetMedia($currentPage/imageAlias, 0)" />

    <img src="{$media/Image/umbracoFile}" alt="{$media/Image/altText}" />

    Has anyone got this to work?  I can't see altText anywhere in the media node, thought maybe it's supposed to output the node name, but I just get a blank alt=""

  • Sajid Riaz 142 posts 165 karma points
    Jul 17, 2010 @ 02:35
    Sajid Riaz
    0

    Hi Claire, not sure may be the more experienced dudes will give a better answer.

    but what i do is add an alt  property to the image datatype.

    and then use it as above.  but there may well be an alt property already around.

     

    >sajid  

  • Sascha Wolter 615 posts 1101 karma points
    Jul 17, 2010 @ 02:41
    Sascha Wolter
    1

    Hi Claire,

    Completely agree with Sajid, just add another property to the Image media type with an alias 'altText' and it should work just fine. I think this was just added for illustration to the wiki.

    Cheers,

    Sascha

  • Claire Botman 48 posts 77 karma points
    Jul 17, 2010 @ 03:44
    Claire Botman
    0

    Thanks Sajid & Sascha I forgot you could add properties to the media types, thanks for reminding me. Should that be added to the wiki page for ppl like me who don't realise?  Can anyone edit them?

    But anyway, for me, the nodeName is good enough as alt text & that way my editors don't need to fill out more properties, I just tried this & found that it worked ok: (cool concise syntax in 4.5!)

    {$media/Image/@nodeName}
  • Sajid Riaz 142 posts 165 karma points
    Jul 17, 2010 @ 04:17
    Sajid Riaz
    0

    Claire, remember that even if you added this property it would not be compulsory.  abd you could set it so that if your editor left it blanck user the @pageName

     

    sajid

Please Sign in or register to post replies

Write your reply to:

Draft