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 1280 posts 3990 karma points MVP 7x c-trib
    Nov 13, 2011 @ 16:44
    Bjarne Fyrstenborg
    0

    Hi...

    How can I list the selected images in a similar way as this: http://www.professorcloud.com/mainsite/cloud-zoom-test.htm

    So I need three image sizes: the original size, a medium thumb, and a small thumb size.
    Can I in some way combine this with the Image Cropper datatype, so the selected image gets the cropped sizes?

    So far I was able to list the images this way:

    <xsl:for-each select="$currentPage//mediaItem/Image">
    <img src="{umbracoFile}" height="100px;"/>
    </xsl:for-each>

    Bjarne

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Nov 13, 2011 @ 16:55
    Jeroen Breuer
    2

    Hello,

    Yes this is possible and there are some good examples you can use :).

    Jeroen
  • Bjarne Fyrstenborg 1280 posts 3990 karma points MVP 7x c-trib
    Nov 13, 2011 @ 17:22
    Bjarne Fyrstenborg
    0

    Hi..

    I've installed DAMP 2.0 ... and Umbraco 4.7.0 as the Tea Commerce Starter Kit v2 is a complete site incl. Umbraco 4.7.0

    The product lists and each product is written with xslt..
    So in this example the value in the image source is refering to the image crop with alias wideCrop? and I then need to specify the crop alias in Image Cropper Property Alias in the datatype?

    <ul>
    <xsl:for-each select="$currentPage/dampNewWide/DAMP/mediaItem/ImageWide">
                  <li>
                    <img src="{wideImage/crops/crop[@name='wideCrop']/@url}" alt="{@nodeName}"/>
                  </li>
    </xsl:for-each>
    </ul>

    If I want a single image, just the first one, should I use? <img src="{$currentPage//mediaItem/Image/umbracoFile}" height="100px;"/>
    I didn't figured out how to use this: 
    <xsl:variable name="file" select="$currentPage/dampFile/DAMP/mediaItem/File" /> .. it didn't seem to work with <xsl:variable name="image" select="$currentPage/dampImage/DAMP/mediaItem/Image" /> .. so probably the dampImage alias that's wrong..

    Bjarne

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Nov 13, 2011 @ 17:31
    Jeroen Breuer
    0

    I haven't used DAMP 2.0 a lot with XSLT, but maybe this example can help you more: http://damp.codeplex.com/SourceControl/changeset/view/81602#1970701.

    Jeroen

  • Bjarne Fyrstenborg 1280 posts 3990 karma points MVP 7x c-trib
    Nov 13, 2011 @ 17:34
    Bjarne Fyrstenborg
    0

    Okay..
    How can a see the xml structure... perhaps it's easier to understand how I should get the images..?

    Bjarne 

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Nov 13, 2011 @ 17:38
    Jeroen Breuer
    0

    You can only see the xml if you're using full media xml in the datatype. The xml is in a file which you can check. In your website folder look for App_Data\umbraco.config. There you can see the xml of your complete website.

    Jeroen

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Nov 13, 2011 @ 17:55
    Tom Fulton
    1

    Hi Bjarne,

    You are correct about the cropping, your code looks for a crop called 'wideCrop' that you need to define in the Image Cropper datatype and add to the ImageWide mediatype.

    To get only the first item in a DAMP picker, you can use: 

    <img src="{$currentPage/yourDampPropertyAlias/DAMP/mediaItem[1]/*/umbracoFile}" />

    The [1] should pull only the first selected media.  I always use * after mediaItem so it handles different media types, but if it's always an Image you could replace with Image.

    -Tom

  • Bjarne Fyrstenborg 1280 posts 3990 karma points MVP 7x c-trib
    Nov 13, 2011 @ 17:58
    Bjarne Fyrstenborg
    0

    Okay, I see..

    I have this:

    <productImage>
                  <DAMP fullMedia="">
                    <mediaItem>
                      <Image id="1165" version="04b00276-f70d-4e25-be23-592fc4e9b93c" parentID="1161" level="3" writerID="0" nodeType="1032" template="0" sortOrder="3" createDate="2011-08-25T12:01:03" updateDate="2011-08-25T12:01:03" nodeName="Product A3" urlName="producta3" writerName="Admin" nodeTypeAlias="Image" path="-1,1160,1161,1165">
                        <umbracoFile>/media/3264/chrysanthemum.jpg</umbracoFile>
                        <umbracoWidth>1024</umbracoWidth>
                        <umbracoHeight>768</umbracoHeight>
                        <umbracoBytes>879394</umbracoBytes>
                        <umbracoExtension>jpg</umbracoExtension>
                        <crops>
                          <crops date="07/11/2011 15:30:09">
                            <crop name="productThumb" x="128" y="0" x2="896" y2="768" url="/media/3264/chrysanthemum_productThumb.jpg" />
                            <crop name="productSmallThumb" x="128" y="0" x2="896" y2="768" url="/media/3264/chrysanthemum_productSmallThumb.jpg" />
                          </crops>
                        </crops>
                      </Image>
                    </mediaItem>
    ...... 

    So I just need to get the productThumb and productSmallThumb crops.. so e.g. for-each selected image with the DAMP it should list productSmallThumb images..

    Bjarne

  • Bjarne Fyrstenborg 1280 posts 3990 karma points MVP 7x c-trib
    Nov 13, 2011 @ 18:19
    Bjarne Fyrstenborg
    0

    Hi Tom

    Thanks for your suggestion..

    It worked with <img src="{$currentPage/productImage/DAMP/mediaItem[1]/*/umbracoFile}" /> to get the original image size..

    I have then tried with

    <img src="{$currentPage/productImage/DAMP/mediaItem/Image/productSmallThumb/crops/crop[@name='productSmallThumb']/@url}" height="50px;"/>

    to get the thumbnail with alias productSmallThumb, but didn't seem to work..

    the crop is created and the xml structure is as above: <productImage><Damp fullMedia=""><mediaItem><Image><crops><crops date="07/11/2011 15:30:09"><crop><crop name="productSmallThumb" x="128" y="0" x2="896" y2="768" url="/media/3264/chrysanthemum_productSmallThumb.jpg" /></crops></crops> .....</productImage>

    Bjarne

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Nov 13, 2011 @ 18:24
    Tom Fulton
    1

    Hi Bjarne,

    Something like this should get you started.  It should loop through your products (replace ... in the first for-each with your selector for products), or remove it if it's only a single product and adjust the second for-each.  Then it loops through all the selected images in productImages and shows both crops:


    <xsl:for-each select="...">

      Product Images:

      <xsl:for-each select="./productImage/DAMP/mediaItem/Image">
        <li>
          <img src="{./productImage/DAMP/mediaItem/Image/crops//crop [@name='productThumb']/@url}" />

          <img src="{./productImage/DAMP/mediaItem/Image/crops//crop [@name='productSmallThumb']/@url}" />
        </li>
      </xsl:for-each>

    </xsl:for-each>

    -Tom

  • Bjarne Fyrstenborg 1280 posts 3990 karma points MVP 7x c-trib
    Nov 13, 2011 @ 18:32
    Bjarne Fyrstenborg
    0

    Yes.. it seems to be correct written in the xslt and the thumbs are created: 
    http://sub.ak-security.dk/media/3264/chrysanthemum_productThumb.jpg and 
    http://sub.ak-security.dk/media/3264/chrysanthemum_productSmallThumb.jpg

    But it didn't seem to give the img src attribute any value: http://sub.ak-security.dk/da/shop/category-a/product-a3.aspx

    Bjarne

  • Bjarne Fyrstenborg 1280 posts 3990 karma points MVP 7x c-trib
    Nov 13, 2011 @ 18:44
    Bjarne Fyrstenborg
    0

    Ahh... this worked to get each thumb of the selected image :)

    <xsl:for-each select="./productImage/DAMP/mediaItem/Image">
              <li>
                <!--<img src="{./productImage/DAMP/mediaItem/Image/crops//crop [@name='productThumb']/@url}" />-->
                <img src="{./crops//crop [@name='productSmallThumb']/@url}" />
            </li>
          </xsl:for-each>

    http://sub.ak-security.dk/da/shop/category-a/product-a3.aspx

    Bjarne

  • Bjarne Fyrstenborg 1280 posts 3990 karma points MVP 7x c-trib
    Nov 13, 2011 @ 19:02
    Bjarne Fyrstenborg
    0

    I've set a test, so it only shows thumbnails when more than one image is selected:

    <xsl:if test="count(./productImage/DAMP/mediaItem/Image) > 1">
    <xsl:for-each select="./productImage/DAMP/mediaItem/Image">
    <li>
    <img src="{./crops//crop [@name='productSmallThumb']/@url}" />
    </li>
    </xsl:for-each>
    </xsl:if>

    Bjarne 

  • Bjarne Fyrstenborg 1280 posts 3990 karma points MVP 7x c-trib
    Nov 13, 2011 @ 20:04
    Bjarne Fyrstenborg
    0

    The way I get a single image is like Tom wrote:

    <img src="{$currentPage/productImage/DAMP/mediaItem[1]/*/umbracoFile}" />
    <img src="{$currentPage/productImage/DAMP/mediaItem[1]/Image/umbracoFile}" /> 

    or to get a crop

    <img src="{./productImage/DAMP/mediaItem[1]/Image/crops//crop [@name='productThumb']/@url}"/>

    Bjarne

Please Sign in or register to post replies

Write your reply to:

Draft