Copied to clipboard

Flag this post as spam?

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


  • Kate 267 posts 610 karma points
    Apr 09, 2013 @ 14:11
    Kate
    0

    The name property from an images

    Hi

    Is it possible to get the Name property of an image.
    I'm making a gallery where the user selects a folder where the images in the folder are displayed. There should be a small text for each picture and I was wondering if I could use image Name property.


    If I can, how do I do that?

    This is the code i have to get holde of all the images in the folder.

    <xsl:choose>
    <xsl:when test="$currentPage/pickAFolder!=''">
    <xsl:variable name="images" select="$currentPage/pickAFolder"/>
    <xsl:variable name="mediaItems" select="umbraco.library:GetMedia($images, true())/Image"/>

    <xsl:for-each select="$mediaItems">
    <xsl:variable name="picFile" select="umbracoFile"/>

    <xsl:element name="img">
    <xsl:attribute name="src">
    <xsl:value-of select="./umbracoFile"/>
    </xsl:attribute>
    </xsl:element>

    </xsl:for-each>
    </xsl:when>
    <xsl:otherwise>
    No Image found
    </xsl:otherwise>
    </xsl:choose>

    /Kate

  • Dennis Aaen 4457 posts 17970 karma points admin hq c-trib
    Apr 09, 2013 @ 14:31
    Dennis Aaen
    100

    Hi Kate,

    I think this should work for you

    <xsl:choose>
            <xsl:when test="$currentPage/pickAFolder!=''">
              <xsl:variable name="images" select="$currentPage/pickAFolder"/>
                   <xsl:variable name="mediaItems" select="umbraco.library:GetMedia($images, true())/Image"/>
               
                    <xsl:for-each select="$mediaItems">
                       <xsl:variable name="picFile" select="umbracoFile"/>
                         
                          <xsl:element name="img">
                              <xsl:attribute name="src">
                                  <xsl:value-of select="./umbracoFile"/>
                              </xsl:attribute>                        
                          </xsl:element>                
                        <p><xsl:value-of select="./@nodeName"/></p>
                    </xsl:for-each>
            </xsl:when>
            <xsl:otherwise>
                No Image found
            </xsl:otherwise>
    </xsl:choose>

    This should print the nodename for each picture in the folder.

    /Dennis

  • Kate 267 posts 610 karma points
    Apr 10, 2013 @ 10:04
    Kate
    0

    Perfect. It works just as I want :-)

    /Kate


  • Dennis Aaen 4457 posts 17970 karma points admin hq c-trib
    Apr 10, 2013 @ 10:08
    Dennis Aaen
    0

    Hi Kate,

    It is great to hear :)

    Glad that I could help you out.

    /Dennis

     

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies