Copied to clipboard

Flag this post as spam?

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


  • Bjarne Fyrstenborg 1284 posts 4038 karma points MVP 8x c-trib
    Nov 22, 2011 @ 17:35
    Bjarne Fyrstenborg
    0

    Get images from folder

    Hi..

    I have listed images from a folder with the code below, but somehow there is also added a number to the first image ....IMG_0122.jpg?1321977528221, which cause the image from displaying.

    <xsl:template match="/">

    <xsl:variable name="slideshowLink" select="number($currentPage/gallerySlideshowLink)"/>
    <xsl:variable name="mediaFolderId" select="number($currentPage/gallerySlideshow)" />

    <xsl:variable name="mediaItems" select="umbraco.library:GetMedia($mediaFolderId, 1)"/>
    <xsl:variable name="numberOfItems" select="count($mediaItems//Image)"/>

    <script>
        $(function(){
          $('#slides').slides({
            preload: true,
            generateNextPrev: true,
            generatePagination: false,
            preloadImage: '/css/gfx/themes/default/loading.gif',
            crossfade: true,
            randomize: true,
            play: 5000,
            pause: 2500,
            hoverPause: true,
            fadeSpeed: 350,
            effect: 'fade'
          });
        });
    </script>

    <div id="slides">
    <div class="slides_container">
    <xsl:if test="number($mediaFolderId)">
      <xsl:for-each select="$mediaItems//Image">
        <xsl:sort select="@sortOrder" order="descending" data-type="number" />
        <xsl:if test="umbracoFile !=''">
        <xsl:variable name="pic" select="umbraco.library:GetMedia($mediaFolderId, 0)/umbracoFile" />
        <div class="item">
            <!--<img src="{concat(substring-before($pic,'.'),'.',substring-after($pic,'.'))}" width="240" height="180" alt="{@nodeName}" />-->
            <!--<img src="{concat(substring-before($pic,'.'),'_SlideImage.',substring-after($pic,'.'))}" width="240" height="180" alt="{@nodeName}" />-->
            <!--<img src="{./umbracoFile}" width="240" height="180" border="0" alt="" />-->
          <img src="{concat('/ImageGen.ashx?Height=180&amp;Image=',umbraco.library:UrlEncode(umbracoFile))}" alt="" height="180" />
        </div>
        </xsl:if>
      </xsl:for-each>
    </xsl:if>
    </div>
    </div>

    <xsl:variable name="galleryLink" select="$currentPage/ancestor-or-self::*[@isDoc]/gallerySlideshowLink"/>
    <a>
      <xsl:choose>
      <xsl:when test="$galleryLink != ''">
        <xsl:attribute name="href"><xsl:value-of select="umbraco.library:NiceUrl($galleryLink)" disable-output-escaping="yes"/></xsl:attribute>
      </xsl:when>
      <xsl:otherwise>
        <xsl:attribute name="style">display: none;</xsl:attribute>
      </xsl:otherwise>
      </xsl:choose>
    <xsl:attribute name="class">gallery_icon_small</xsl:attribute>
    <xsl:text</xsl:text>
    </a>
     
    <p>Antal billeder i galleriet: <xsl:value-of select="$numberOfItems"/></p>
      <href="{umbraco.library:NiceUrl($slideshowLink)}" class="small_button floatRight"><span>Se flere billeder</span></a>
    </xsl:template>

    Bjarne

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Nov 22, 2011 @ 18:22
    Tom Fulton
    0

    I wonder if maybe your slideshow javascript is adding the querystring to the image to prevent it from being cached.  What plugin are you using?  Maybe check the documentation to see if it does something like that and if you can disable it.  Also try removing the javascript and seeing if the images display to narrow down the problem.

    Hope this helps,
    Tom

  • Bjarne Fyrstenborg 1284 posts 4038 karma points MVP 8x c-trib
    Nov 22, 2011 @ 18:45
    Bjarne Fyrstenborg
    0

    Hi Tom..

    I am using this plugin: http://slidesjs.com/

    You're right, when I remove the javascript from the xslt file it's not adding ?1321977528221 to the first image..
    I have used the plugin before for a slideshow on this site on the homepage: http://oldengaard.dk/ 
    But the slides was created of child nodes and their properties..

    This time I have a gallerySlideshow property on the homepage doc type, which is a mediapicker to pick a folder from the media section either the top folder containing the galleries or a specific child node folder with a gallery to loop images from.

    Bjarne

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Nov 22, 2011 @ 19:46
    Tom Fulton
    1

    Hi Bjarne,

    You might need to modify the source as I don't see any documented options to disable that.  The reason it's failing is probably because you are using ImageGen which adds it's own querystring, then it's trying to add another one on top of that.

    I think you can modify this easily though:

                    // gets image src, with cache buster
                    var img = control.find('img:eq(' + start + ')').attr('src') + '?' + (new Date()).getTime();

    change to:

                    // gets image src, with cache buster
                    var img = control.find('img:eq(' + start + ')').attr('src');

    -Tom

  • Bjarne Fyrstenborg 1284 posts 4038 karma points MVP 8x c-trib
    Nov 22, 2011 @ 20:13
    Bjarne Fyrstenborg
    0

    Okay, you have modified slides.jquery.js file?

    I am using slides.min.jquery.js file which is the one used in the simple version: http://slidesjs.com/examples/simple/

    I'm not sure where the slides.jquery.js is used ... it's included in the download, but the examples projects all use the slides.min.jquery.js file..

    Bjarne

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Nov 22, 2011 @ 20:15
    Tom Fulton
    0

    The .min.js file is just the minified version.  To make things easier I would just modify it in the regular .js file and update your code to reference that instead.  Or you could modify it in the .min.js version but it might be trickier to find :)

  • Bjarne Fyrstenborg 1284 posts 4038 karma points MVP 8x c-trib
    Nov 22, 2011 @ 20:50
    Bjarne Fyrstenborg
    0

    Ahh okay :) .. so the code is just compressed in some way in that file?

    I have just used the slides.jquery.js file and changed that codeline.. and it seems to fix it.. :)
    http://sub.ak-security.dk (the slideshow on bottom right) 

    Thanks for your help Tom..

    Bjarne

Please Sign in or register to post replies

Write your reply to:

Draft