Search

Is there any way to resize images proportionally, can’t get it to work with the JIT, like

/image/1/400/300/5

What I’m trying to do is to resize proportionally to a boundary box (400x300) regardless of input format

thanks, J

I’ll answer myself:

this might be it: http://getsymphony.com/download/xslt-utilities/view/38341/

You might want to try mode=2 which is “resize and crop”.

http://getsymphony.com/learn/concepts/view/jit-image-manipulation/

Something like:

/image/2/400/300/5/path

2 is the mode, and 5 is saying crop to the centre (see the grid at the bottom of the above URL).

Thanks, but that crops the pic

I need to do this (didn’t know you could pass 0 as argument) http://getsymphony.com/discuss/thread/25212/

ie.

/image/1/400/0 and
/image/1/0/300

and then somehow choose the smallest

J

I’ve been wanting the exact same aswell for a photo album.

Cropping the images does not seem to be the best approach, as some details of the photo get lost that way.

I have solved this by adding an if statement in the xslt that checks the aspect ratio, and chooses one of the hrefs accordingly.

From what I recall, the if statement looked something like this:

<xsl:if test="(image/meta/@width div image/meta/@height) &gt; (4 div 3)">
    <xsl:attribute name="href">
        <xsl:value-of select="concat($root,'/image/1/400/0/',image/@path,image/filename)"/>
    </xsl:attribute>
</xsl:if>
<xsl:if test="(image/meta/@width div image/meta/@height) &lt; (4 div 3)">
    <xsl:attribute name="href">
        <xsl:value-of select="concat($root,'/image/1/0/300/',image/@path,image/filename)"/>
    </xsl:attribute>
</xsl:if>

Hope that helped.

EDIT: this should ofcourse be placed inside the image tag.

fantastic!

Danku, J

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details