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

Simon Schaufelberger (Schaufi) simonschaufi at guugelmail.de
Wed Apr 9 02:20:18 CEST 2014


oh by the way can somebody please add the gerrit bot to the tt_news 
forge project so that the bot can update the issue status? thank you!

Regards, Schaufi

Am 09.04.2014 02:08, schrieb Simon Schaufelberger (Schaufi):
> Thank you very much for this really understandable explanation!!! I
> think this is the first time after years that i understand it :D
>
> One more thing: when would it make sense to use both: height and maxH?
>
> Ok, i just found a BUG in tt_news! That was the place where the image
> was not rendered right.
>
> see http://forge.typo3.org/issues/57758
>
> in this case the "m" is not appended which results in wrong image size
> in latest mode.
>
> Regards, Schaufi
>
> Am 08.04.2014 12:57, schrieb JoH asenau:
>>> 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.
>>
>> HTH
>>
>> Joey
>>


More information about the TYPO3-team-core mailing list