Copied to clipboard

Flag this post as spam?

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


  • Natasha 79 posts 195 karma points
    May 31, 2013 @ 18:01
    Natasha
    0

    Display multiple images on the same page fro, media picker

    Hi all

    I would like a user to be able to pick several images from the media folder to display in different areas of the same page url http://test.transitioninfonetwork.org.uk/home.aspx where there's big white gaps with numbers there should be images.  I tried to edit my xslt accordingly, but don't know if what I am trying to do will work.  Is my syntax wrong? or do I need to write seperate xslt for each image?

    Please help

    Thanks

    Natasha

    <?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" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" 
      exclude-result-prefixes="msxml  umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes  Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings  Exslt.ExsltSets ">
    <xsl:output method="xml" omit-xml-declaration="yes"/>
    <xsl:param name="currentPage"/>
    <xsl:template match="/">
    <xsl:variable name="image" select="$currentPage/*[starts-with(name(),'image')]"/>
        <xsl:if test="$image > 0">
            <xsl:variable name="mediaNode" select="umbraco.library:GetMedia($image, 0)" />
            <xsl:if test="$mediaNode/umbracoFile">
                <img class="image_resize" src="{$mediaNode/umbracoFile}" />
            </xsl:if>
        </xsl:if>

    </xsl:template>
    </xsl:stylesheet>
  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    May 31, 2013 @ 21:23
    Dennis Aaen
    0

    Hi Natasha,

    One way I think you could do it is to add a media picker to the document type that creates the content the small stories (div class="small_story").

    And then in the place where you output data from div class="small_story add the below XSLT snippet in the small_body_image div tag, to render the image that you picked, on media picker at the current story.

    <xsl:if test="$currentPage/YourMediaPickerAlias !=''">   
           <xsl:variable name="media" select="umbraco.library:GetMedia($currentPage/YourMediaPickerAlias, 0)" />
           <xsl:variable name="alt" select="umbraco.library:GetMedia($currentPage/YourMediaPickerAlias, 0)/@nodeName" />
               <img src="{$media/umbracoFile}" alt="{$alt}"/>
    </xsl:if>

    Remeber to change the YourMediaPickerAlias to your alias of the media picker. I hope this make sense, and will work for you.

    /Dennis

  • Natasha 79 posts 195 karma points
    Jun 05, 2013 @ 11:41
    Natasha
    100

    Thanks Dennis.  I took your idea and rendered each image within the template from another post from Kim (code below) and now it works. 

    <umbraco:Itemrunat="server"field="mediaPickerAlias"xslt="concat('&lt;img src=&quot;',umbraco.library:GetMedia({0}, true())/umbracoFile, '&quot; /&gt;')"xsltDisableEscaping="true"/>
  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jun 05, 2013 @ 15:12
    Dennis Aaen
    0

    Glad that you could use my advice, and you got it to work.

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft