Copied to clipboard

Flag this post as spam?

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


  • CMSPlusHosting 9 posts 29 karma points
    Jun 27, 2011 @ 22:10
    CMSPlusHosting
    0

    GetMedia XSLT / NiceURL issue?

    The URL Im getting is returning as :

    /media/1115/bg_promo_visual_01.png553508321953png

     

    This is the XSLT Im using:
    <xsl:value-of select="umbraco.library:GetMedia(data [@alias = 'SliderImage'],'false')"/>

     

    The XML being returned for the page is..


    slider
    items
    item
    data alias=SliderImage>1121 /data


    Help? Having problems getting the correct URL... XSL Noob ..

  • MartinB 411 posts 512 karma points
    Jun 27, 2011 @ 22:22
    MartinB
    1

    Hi

     

    Try this:

    <img src="{umbraco.library:GetMedia(data [@alias = 'yourImageProperty'],0)/data[@alias = 'umbracoFile']}"/>
  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jun 27, 2011 @ 22:23
    Tom Fulton
    1

    Hi,

    The GetMedia call returns an XML nodeset of the entire Media item - including it's file path, size, extension, etc.  In most cases you just want the file path so you can display the image, to get that you would look for the umbracoFile property

    Ex:

    <xsl:value-of select="umbraco.library:GetMedia(data [@alias = 'SliderImage'],'false')/data [@alias='umbracoFile']"/>

    Hope this helps,
    Tom

  • CMSPlusHosting 9 posts 29 karma points
    Jun 27, 2011 @ 22:51
    CMSPlusHosting
    0

    trying to set an inline style sheet ... background url..  I've tried the umbracoFile and without any luck...  displays blank when I do that.

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jun 27, 2011 @ 23:00
    Tom Fulton
    0

    Try dumping the contents of GetMedia into a textbox, so we can ensure we are getting the right XML back and umbracoFile is there.  You can do this by pasting the following in your XSLT

    <textarea>
      <xsl:copy-of select="umbraco.library:GetMedia(data [@alias = 'SliderImage'],'false')"/>
    </textarea>

    Paste the contents of the textbox here.

    -Tom

  • CMSPlusHosting 9 posts 29 karma points
    Jul 02, 2011 @ 17:15
    CMSPlusHosting
    0

    Okay, from the textbox result it appears as though I got data returned:

     
    <Image id="1124" version="cfdb8692-8ac2-46be-90dc-59b407f7f549" parentID="1109" level="2" writerID="0" nodeType="1032" template="0" sortOrder="3" createDate="2011-06-29T18:05:54" updateDate="2011-06-29T18:05:54" nodeName="bg_promo_visual_03" urlName="bg_promo_visual_03" writerName="Administrator" nodeTypeAlias="Image" path="-1,1109,1124"><umbracoFile>/media/1176/bg_promo_visual_03.png</umbracoFile><umbracoWidth>553</umbracoWidth><umbracoHeight>508</umbracoHeight><umbracoBytes>42612</umbracoBytes><umbracoExtension>png</umbracoExtension></Image>
  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jul 02, 2011 @ 21:17
    Tom Fulton
    0

    Hi,

    Ok, I'm a bit confused...do you know if you are using the new or old XSLT schema?  Your XSLT to call the SliderImage field is in the old format (data [@alias='SliderImage']) but your Media seems to be in the new format (umbracoFile instead of data [@alias='umbracoFile'])...

    Anyway, this should work, although it seems something strange is going on:

    <xsl:value-ofselect="umbraco.library:GetMedia(data [@alias = 'SliderImage'],'false')/umbracoFile"/>

    -Tom

  • CMSPlusHosting 9 posts 29 karma points
    Jul 02, 2011 @ 21:31
    CMSPlusHosting
    0

    Thanks Tom, its working nicely.

Please Sign in or register to post replies

Write your reply to:

Draft