Copied to clipboard

Flag this post as spam?

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


  • Patrick 23 posts 83 karma points
    Feb 26, 2012 @ 10:11
    Patrick
    0

    Being fairly new to Umbraco I have a question.

    I'm building à website in version 4 and I have ceated a project documenttype.

    Within thuis document type I want to make it possible for an editor to upload an x amount of images.

    So there van be one or more images, how do i achieve this?

    Greetings, Patrick

  • Fuji Kusaka 2203 posts 4220 karma points
    Feb 26, 2012 @ 11:18
    Fuji Kusaka
    0

    Hi Patrick,

    From what i understand you want the editor to be able to display images on the page itself right? ...... One way of doing this is by adding a property type "Media Picker" in your document type which will allow you to access the corresponding media folder under which you added the images.

    You will have to create an XSLT Macro to display the images. If this is how you want here is an example that might help

    Where yourImages is the alias you named in your document type

    <xsl:param name="currentPage"/>
    <xsl:variable name="yourImages" select="number($currentPage/yourImages)"/>


    <xsl:template match="/">
    <!-- start writing XSLT -->   
                       
      <xsl:if test="number($yourImages)">
        <div id="lux-anim-slide"> 
            <xsl:for-each select="umbraco.library:GetMedia($yourImages, 'true')/Image">
                <xsl:element name="img">
                    <xsl:attribute name="src">
                      <xsl:value-of select="umbracoFile"/>
                  </xsl:attribute>
              </xsl:element>
        </xsl:for-each>
       </div>
    </xsl:if>
    </xsl:template>
  • Bjarne Fyrstenborg 1280 posts 3990 karma points MVP 7x c-trib
    Feb 26, 2012 @ 16:45
    Bjarne Fyrstenborg
    0

    Hi Patrick

    You could take a look at the DAMP package which let you pick multiple images..

    There is included examples how to use it with xslt and razor..

    An example from one of my projects looks like this:

    <xsl:variable name="mediaImage" select="./productImage/DAMP/mediaItem/Image"/> 

    <
    ul>
       <xsl:for-each select="$mediaImage">
          <li>
             <img src="{$mediaImage/umbracoFile}" alt="" />
          </li>
       </xsl:for-each>
    </ul>


    Bjarne

Please Sign in or register to post replies

Write your reply to:

Draft