[TYPO3-core] image width, height, maxW, maxH...

JoH asenau info at cybercraft.de
Tue Apr 8 12:57:39 CEST 2014

> For now one thing:
> I have an image of 500x500px.
> I set:
> maxW = 120
> maxH = 140
> What would you expect is the output?
> I would expect a square image with 120x120. BUT what is TYPO3 rendering?
> The output is 120x140.

Which is correct when you take a look at the description of width, 
height, maxW, minW in TSref. "maxW" and "maxH" are just upper limits for 
"width" and "height". The actual behaviour regarding proportions and 
cropping is always defined in "width" and "height".

You got 3 options, which are IMHO not that hard to understand:

1. Plain integers. These values might rescale the image without keeping 
the proportions.

width = 120
height = 140

Would give you the same result as in your example.

2. Integers followed by an "m". These will behave exactly the way that 
you expected from maxW and maxH

width = 120m
height = 140m

Would give you the 120 x 120 version you expected.

3. Integers followed by a "c". These will rescale the image until both 
width and height reached at least the minimum value given by the integer 
and then crop the overlapping parts.

width = 120c
height = 140c

Would give you a 140 x 140 square cropped to a width of 120.

For 3 you can add some calculation after the "c" do decide which part 
should be cropped.
Positive values will move the cropped part to the top or left, negative 
values will move it to the bottom or right.

width = 120c-100
height = 140c

Would give you the same image as before, but cropped only from the right.



Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your gob sometimes!)
Dieter Nuhr, German comedian
Xing: http://contact.cybercraft.de
Twitter: http://twitter.com/bunnyfield
TYPO3 cookbook (2nd edition): http://www.typo3experts.com

More information about the TYPO3-team-core mailing list