[TYPO3] Math in TypoScript

Bertalan Fodor berfod at organum.hu
Fri Feb 23 10:07:20 CET 2007


Yes, you are right, it is not necessary, only would be useful. Because 
in extension templates with different croppings, without this math, I 
have to define four variables (xoffset, yoffset, xoffset2, yoffset2), 
where xoffset2 and yoffset2 are always are the same relative to xoffset 
and yoffset, however, with the math I'd just need to define two.

Bert

JoH asenau írta:
>> I have a header image that is different for each page, and the image
>> itself is horizontally cut into two parts, to allow nice curved border
>> in a table-based layout.
>> So I set the upper part of the image like this:
>> 1.file.param = -resize 100x50 -crop 40x30+0+0
>>
>>
>> The lower part's crop should move according to the upper part's crop,
>> like this:
>>
>> 2.file.param = -resize 100x50 -crop 37x20+43+30
>>
>> Sometimes I want to change the crop offset parameter, to get an other
>> part of the image, so the upper and the lower parts should move
>> together.
>>
>> So I want like this:
>>
>> 1.file.param = -resize 100x50 -crop 40x30+{$xoffset}+{$yoffset}
>>
>> 2.file.param = -resize 100x50 -crop 37x20+{$xoffset + 43} + {$yoffset
>> + 30}
>>
>> I hope you can understand me.
> 
> Not really, since I don't understand why you want to do any math here.
> If the crop is different on a per page base, you can simply change the
> parameters using an extension template (+ext) for the pages.
> 
> The rest of the template will stay as is while only one different line of TS
> will change the behaviour of the image for each page.
> 
> Calculating the crop parameters would only make sense if you need to do it
> based on dynamic values (i.e. GET parameters or other stuff that could
> influence the crop) - but in this case there seems to be nothing like that,
> so no math necessary.
> 
> HTH
> 
> Joey
> 


More information about the TYPO3-english mailing list