Copied to clipboard

Flag this post as spam?

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


  • Fuji Kusaka 2203 posts 4220 karma points
    Sep 25, 2011 @ 14:35
    Fuji Kusaka
    0

    Keeping aspect Ratio in ImageGen 2.5.2

    Hi All,

    Is it possible to keep Image Aspect in ImageGen 2.5.2? Am using am the basic version of ImageGen and when am displaying the images they are not very nice to look at even i want them as thumbnails with a specific width and height.

    But somehow i would like to keep the Image Aspect as an Image Cropper would. Here is my XSLT when displaying images.

     

    <xsl:param name="currentPage"/>
        <xsl:variable name="photoGallery" select="number($currentPage/photoGallery)" />
        <xsl:variable name="thumbWidth" select="number(110)" />
        <xsl:variable name="thumbHeight" select="number(106)" />

    <xsl:template match="/">

    <!-- start writing XSLT --
           
            <xsl:if test="number($photoGallery)">
                  <xsl:for-each select="umbraco.library:GetMedia($photoGallery, 'true')/Image">
                     <xsl:variable name="originalWidth" select="umbracoWidth"/>
                      <xsl:variable name="originalHeight" select="umbracoHeight"/>
                      
                        <xsl:if test="umbracoFile !=''">                                           
                                <a href="/imageGen.ashx?image={umbraco.library:UrlEncode(umbracoFile)}&amp;width={$originalWidth}&amp;height={$originalHeight}" title="{@nodeName}" rel="gallery">
                                    <img src="/imageGen.ashx?image={umbraco.library:UrlEncode(umbracoFile)}&amp;width={$thumbWidth}&amp;height={$thumbHeight}&amp;constrain=false&amp;crop=resize" alt="{@nodeName}" title="{@nodeName}"/>
                                </a>                      
                        </xsl:if>
                      
                    </xsl:for-each>
                

            </xsl:if>


    </xsl:template>
  • Arnold Visser 418 posts 778 karma points hq c-trib
    Sep 26, 2011 @ 07:37
    Arnold Visser
    0

    constrain=false ==> constrain=true should do the trick :)

  • Fuji Kusaka 2203 posts 4220 karma points
    Sep 26, 2011 @ 07:43
    Fuji Kusaka
    0

    When i set Constrain = true, the thumbnails are not of the same size. So setting it to 'true' is not making any good for me.

     

  • Arnold Visser 418 posts 778 karma points hq c-trib
    Sep 26, 2011 @ 07:47
    Arnold Visser
    0

    Just to be sure: you do know that the crop=resize function needs a profesisonal Imagegen license?

  • Fuji Kusaka 2203 posts 4220 karma points
    Sep 26, 2011 @ 07:58
    Fuji Kusaka
    0

    I thought the Resize was part of the Basic Version. Just had a look at it http://www.percipientstudios.com/imagegen/features.aspx.

    Ok i need to get buy the Pro Version to make thuis work then.



  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Sep 27, 2011 @ 10:16
    Douglas Robar
    0

    Hi, Fuji,

    Yes, you'll need ImageGen Professional to use the &crop= feature. If you have any problems getting the parameters set to achieve what you want, just give a couple examples (with links) to what you're trying and we'll help you get it working just right.

     

    By the way, in your xslt above you don't need to use ImageGen.ashx for the <a href=""> since you are just asking for the original image. You could simply use this instead:

    <a href="{umbraco.library:UrlEncode(umbracoFile)}" width="{$originalWidth}" height="{$originalHeight}" title="{@nodeName}" rel="gallery"> 

    cheers,
    doug. 

  • Fuji Kusaka 2203 posts 4220 karma points
    Sep 27, 2011 @ 11:09
    Fuji Kusaka
    0

    Hi Doug,

    I'll drop you an email with the examples of resize i want to achieve automatically using imagenGen.



  • Fuji Kusaka 2203 posts 4220 karma points
    Sep 27, 2011 @ 12:13
    Fuji Kusaka
    0

    Doug this is not working for me

     <href="{umbraco.library:UrlEncode(umbracoFile)}" title="{@nodeName}" rel="gallery" width="{$originalWidth}" height="{$originalHeight}">
  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Sep 27, 2011 @ 12:25
    Douglas Robar
    0

    What you have in your xslt file is the following:

    <a href="img={umbraco.library:UrlEncode(umbracoFile)}" title="{@nodeName}" rel="gallery" width="{$originalWidth}"height="{$originalHeight}">

     

    You shouldn't have the img= in the href. It should be:

    <a href="{umbraco.library:UrlEncode(umbracoFile)}" title="{@nodeName}" rel="gallery" width="{$originalWidth}"height="{$originalHeight}">
  • Fuji Kusaka 2203 posts 4220 karma points
    Sep 27, 2011 @ 12:35
    Fuji Kusaka
    0

    Sorry Doug am using 

    <a href="{umbraco.library:UrlEncode(umbracoFile)}" title="{@nodeName}" rel="gallery" width="{$originalWidth}" height="{$originalHeight}">

    but not working.


  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Sep 27, 2011 @ 12:45
    Douglas Robar
    0

    I suspect that because you're UrlEncode'ing the path the browser isn't handling it properly. 

    In other words, the href="%2fmedia%2f3698%2ftam_extjour80_cr.jpg" rather than href="/media/3698/tam_extjour80_cr.jpg". Because there is no slash at the start the browser appends the href to the current url's path.

    So, you could either stop UrlEncode'ing the umbracoFile:

    <a href="{umbracoFile}" title="{@nodeName}" rel="gallery" width="{$originalWidth}" height="{$originalHeight}">

    Or, you could add a slash to the beginning of the href:

    <a href="/{umbraco.library:UrlEncode(umbracoFile)}" title="{@nodeName}" rel="gallery" width="{$originalWidth}" height="{$originalHeight}">

    cheers,
    doug. 

  • Fuji Kusaka 2203 posts 4220 karma points
    Sep 27, 2011 @ 12:59
    Fuji Kusaka
    0


    I guess i'll just stick to which works.

    <ahref="{umbracoFile}"title="{@nodeName}"rel="gallery"width="{$originalWidth}"height="{$originalHeight}">

    But thanks again.

    Cheers,
    Fuji

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies