Copied to clipboard

Flag this post as spam?

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


  • Frost 5 posts 25 karma points
    Nov 04, 2011 @ 09:50
    Frost
    0

    Thumbnail gallery not showing

    Please help, im trying to show the thumbnail on my gallery

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [
        <!ENTITY nbsp "&#x00A0;">
    ]>
    <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxml="urn:schemas-microsoft-com:xslt"
      xmlns:umbraco.library="urn:umbraco.library"
      exclude-result-prefixes="msxml umbraco.library">

        <xsl:output method="xml" omit-xml-declaration="yes"/>

        <xsl:param name="currentPage"/>
        <xsl:variable name="imagesPerRow" select="6"/>

        <!-- =============================================================== -->

        
        
        <xsl:template match="/">
            
          <ul>
            <xsl:for-each select="$currentPage/* [@isDoc]">

                <!-- display each image in the row, with the count of photos in each gallery -->
                <li>
                    <href="{umbraco.library:NiceUrl(@id)}">
                        <div class="photo">  
                          
                          <xsl:variable name="ext" select="concat('.', umbracoExtension)" />
                  <img src="{concat(substring-before(umbracoFile,'.'), '_thumb', $ext)}" alt="{@nodeName}" /> 
                        </div>
                        <span class="name">
                            <xsl:value-of select="@nodeName"/>
                        </span>
                    </a>
                  
                    <span class="meta">
                    <xsl:value-of select="count(./* [@isDoc])"/>

                    <xsl:textPhoto</xsl:text>
                    <xsl:if test="count(./* [@isDoc]) &gt; 1">
                        <xsl:text>s</xsl:text>
                    </xsl:if>
                    </span>
                </li>

            </xsl:for-each>
          </ul>
          
        </xsl:template>

        <!-- =============================================================== -->

    </xsl:stylesheet>

    This is the thumbail path showing http://somedomain.com/_thumb.

    What am i missing? Thanks much.

     

     

  • Michael Latouche 504 posts 819 karma points MVP 3x c-trib
    Nov 04, 2011 @ 09:58
    Michael Latouche
    0

    Hi Frost,

    Can you specify the problem a little bit. Do you get nothing displayed at all? Or are the images showing but with wrong links? Are your images direct nodes under your current page, or are these media items?

    Cheers,

    Michaƫl.

  • Frost 5 posts 25 karma points
    Nov 04, 2011 @ 10:11
    Frost
    0

    Oh sorry, images are not displayed http://i.imgur.com/1wN8a.jpg

    im using getmedia like this http://i.imgur.com/Ghui4.jpg

    and im getting the media here http://i.imgur.com/BS1Ap.jpg

     

  • Michael Latouche 504 posts 819 karma points MVP 3x c-trib
    Nov 04, 2011 @ 11:16
    Michael Latouche
    0

    Hi Frost,

    If I understand correctly, you have a property on your document in which you can specify the media folder to associate to the document. I assume the name of that property is MyMediaFolder. It actually contains the Id (int) of the media folder. And then this media folder contains one (or more?) images that you want to display in your gallery.

    I am no XSLT expert so I can't pull out the exact code like that, but I think this is what your XSLT should look like, in pseudo-code:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [
        <!ENTITY nbsp "&#x00A0;">
    ]>
    <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxml="urn:schemas-microsoft-com:xslt"
      xmlns:umbraco.library="urn:umbraco.library"
      exclude-result-prefixes="msxml umbraco.library">

        <xsl:outputmethod="xml"omit-xml-declaration="yes"/>

        <xsl:paramname="currentPage"/>
        <xsl:variablename="imagesPerRow"select="6"/>

        <!-- =============================================================== -->

       
       
        <xsl:templatematch="/">
           
          <ul>
            <xsl:for-eachselect="$currentPage/* [@isDoc]">

                <!-- display each image in the row, with the count of photos in each gallery -->
                <li>
                    <ahref="{umbraco.library:NiceUrl(@id)}">
                        <divclass="photo">  
                          <!-- Added pseudo-code -->

                          <xsl:variablename="mediaFolderId" select="./MyMediaFolder"/> 

                           With this var, which now contains the Id of the media folder, you have to call a library method to get the actual media folder, so something like

                            <xsl:variable name="mediaFolder" select="Library.GetMediaFolderById($mediaFolderId)"/>

    Then you need to loop through all images under the mediaFolder to get all images, so something like

    <xsl:for-eachselect="$mediaFolder/* "> <!-- Or maybe add some filter like  [@isDoc] -->


                                    <xsl:variablename="ext"select="concat('.', umbracoExtension)"/>
                                     <imgsrc="{concat(substring-before(umbracoFile,'.'), '_thumb', $ext)}"alt="{@nodeName}"/>

    </xsl:for-each>
                        </div>
                        <spanclass="name">
                            <xsl:value-ofselect="@nodeName"/>
                        </span>
                    </a>
                 
                    <spanclass="meta">
                    <xsl:value-ofselect="count(./* [@isDoc])"/>

                    <xsl:text>Photo</xsl:text>
                    <xsl:iftest="count(./* [@isDoc]) &gt; 1">
                        <xsl:text>s</xsl:text>
                    </xsl:if>
                    </span>
                </li>

            </xsl:for-each>
          </ul>
         
        </xsl:template>

        <!-- =============================================================== -->

    </xsl:stylesheet>

     

    I hope this helps you get on the right track.

    Cheers,

    Michael.

  • Michael Latouche 504 posts 819 karma points MVP 3x c-trib
    Nov 04, 2011 @ 11:18
    Michael Latouche
    0

    Sorry for the formatting, it was messed up when posted... And edit mode does not do better :-S

    Cheers,

    Michael

Please Sign in or register to post replies

Write your reply to:

Draft