[TYPO3-dev] CropScale in imgResource

Stefan Geith typo3dev at geithware.de
Sat Jan 14 15:21:47 CET 2006


Daniel Doesburg [netcreators] schrieb:
> Stefan Geith schreef:
>> What is confusing with
>>   cropH: -100=left, 0=center, 100=right
>>   cropV: -100=top,  0=center, 100=bottom
> 
> It's confusing.
> 
> You also wrote:
> Example:
> Imagesize = 400x300px
> width/height = 200c x 100c
> Scaled Image is 200x150px
> - CropH now doesn't matter, because the width is already 200px
> - Set CropV to 0 to cut 25px at the top and 25px at the bottom
> - Set CropV to -50 to cut 12px at the top and 38px at the bottom

The original size was just an example -
you cannot know, what dimensions - or better
what aspect-ratio) your original and/or scaled
image has;
If it was a 400x380px, it would be scaled to 200x190px
and then cropped.

> It should be a % from the scaled but not croped.
> So I would think 50px from 150 = 33,33333%
> So both sides 16,66666%. But in your example you say 25%
> 
> What is the reason of my confusion?

Look here:
in the above example, I have to cut 50px,
that is (if centered) 25px at the top and 25px at the bottom;
-100% now means: lower the 25px top-cropping by 100% giving 0%
       and add the 100% of 25px to the bottom-cropping giving 50%
-50% now means: lower the 25px top-cropping by 50% giving 12.5px
       and add this to the bottom giving 27.5px

Imagine you have the 400x380px, you have to cut 90px, that
is (if centered) 45px at the top and 45px at the bottom.
-50% now means: lower the 45px top-cropping by 50% giving 22.5px
       and add this to the bottom giving 67.5px

> 
> Where goes it wrong in my calculation?
> 
Is it now clearer ?

-

Stefan




More information about the TYPO3-dev mailing list