Copied to clipboard

Flag this post as spam?

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


  • Hutch White 89 posts 112 karma points
    Feb 09, 2011 @ 22:01
    Hutch White
    0

    Retrieving Media Items for Photo Gallery

    Ok, let me start with I've read a few posts but nothing seems to be working for me.  I'm using 4.5.2.

    I've created a directory under media named "PhotoGallery".  I intend to use this to store images here for my gallery.  I started by looking into some other forums and such.  I added a media picker to my page and selected "PhotoGallery" from the media picker.  I have two photos under this directory in the Media section.  Below is my xslt.  1074 is the ID for the "PhotoGallery" media node.  I'm getting nothing returned.

      <xsl:for-each select="umbraco.library:GetMedia(1074, 'true')/node">

          <li>
            <class="image" rel="gallery">
              <xsl:attribute name="href">
                <xsl:value-of select="umbraco.library:GetMedia(@id, 'false')/data [@alias='umbracoFile']"/>
              </xsl:attribute>
              <img>
                  <xsl:attribute name="src">
                    <xsl:value-of select="Exslt.ExsltStrings:replace(umbraco.library:GetMedia(@id, 'false')/data [@alias='umbracoFile'], '.', '_thumb.')"/>            
                  </xsl:attribute>
              </img>
            </a>
         </li>
      </xsl:for-each>

  • Kim Andersen 1447 posts 2196 karma points MVP
    Feb 09, 2011 @ 22:07
    Kim Andersen
    0

    Hi Hutch

    Looks like the code you are using are for the legacy XML schema. Try this instead:

      <xsl:for-each select="umbraco.library:GetMedia(1074, 1)/Image">

          <li>
            <class="image" rel="gallery">
              <xsl:attribute name="href">
                <xsl:value-of select="umbraco.library:GetMedia(@id, 0)/umbracoFile"/>
              </xsl:attribute>
              <img>
                  <xsl:attribute name="src">
                    <xsl:value-of select="umbraco.library:Replace(umbraco.library:GetMedia(@id, 0)/umbracoFile, '.', '_thumb.')"/>            
                  </xsl:attribute>
              </img>
            </a>
         </li>
      </xsl:for-each>

    Does this give you any output?

    /Kim A

     

  • Hutch White 89 posts 112 karma points
    Feb 09, 2011 @ 22:14
    Hutch White
    0

    Yes! Success!!!! Thank you!

  • Kim Andersen 1447 posts 2196 karma points MVP
    Feb 09, 2011 @ 22:24
    Kim Andersen
    0

    You are welcome Hutch!

    Maybe you could consider putting this extension call:

    umbraco.library:GetMedia(@id, 0)

    in the for-each into a variable to save some extensions-calls. Like this:

    <xsl:variable name="madiaNode" select="umbraco.library:GetMedia(@id,0)" />

    and then you can use the $mediaNode the two places where you called the GetMedia in the for-each. Just an idea to save some extension calls.

    /Kim A

  • Kim Andersen 1447 posts 2196 karma points MVP
    Feb 09, 2011 @ 22:24
    Kim Andersen
    0

    You are welcome Hutch!

    Maybe you could consider putting this extension call:

    umbraco.library:GetMedia(@id, 0)

    in the for-each into a variable to save some extensions-calls. Like this:

    <xsl:variable name="madiaNode" select="umbraco.library:GetMedia(@id,0)" />

    and then you can use the $mediaNode the two places where you called the GetMedia in the for-each. Just an idea to save some extension calls.

    /Kim A

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Feb 09, 2011 @ 23:33
    Jeroen Breuer
    0

    Hi Hutch,

    I've created the Digibiz Advanced Media Picker. With this new media picker you can store multiple items in 1 picker which is perfect for creating a photo gallery. You can watch a very simple photo gallery sample here: http://screenr.com/TEY.

    Jeroen

Please Sign in or register to post replies

Write your reply to:

Draft