[TYPO3] get size of generated image with gifbuilder

Christopher Torgalson bedlamhotel at gmail.com
Thu Dec 21 17:05:20 CET 2006


Hi Rob,

On 12/21/06, Rob De Vries <spam_this at pandora.be> wrote:
> Hey,
>
> How can I get the size of a generated image (with gifbuilder) ?
> what i have at this poinnt is:
>
> 10.file = GIFBUILDER
>    10.file {
>         maxWidth = 550
>         backColor = #374e9d
>         XY = 550,[5.h]+40
>
>      5 = TEXT
>      5 {
>         text.field = abstract//title
>         #value = {page:abstract}
>         fontSize = 18
>         #fontColor = #374e9d
>         fontColor = white
>         offset = 5,25
>         offset = 0,18
>         fontFile = fileadmin/templates/font/RotisSemiSerif.otf
>         #antiAlias = 1
>         niceText = 1
>
>         backColor = white
>         textMaxLength = 500
>         }
> }
>
> A normal TS for generating an image with text on it used as a background
> image.
> Bbecauuse I use the abstract field for the text input, the image can
> variate in height and I need the height of the generated image to be
> used as thhe height of the span that has this image as a background image.
>
> Any way I can retrieve this information?


It depends; if the GIFBUILDER's parent object is an IMAGE, then yes
you can get the size:

"The array $GLOBALS["TSFE"]->lastImageInfo is set with the info-array
of the returning image (if any) and contains width, height and so on."
[1]

The same information IS determined by the core when using
IMG_RESOURCE, but it is not retained. I've requested this as a feature
addition, but I don't think it's made it into the core yet--if it'd be
useful to you too, maybe add a comment to the bugtracker:
http://bugs.typo3.org/view.php?id=4006


-- 
Christopher Torgalson


[1] http://typo3.org/documentation/document-library/references/doc_core_tsref/4.0.0/view/8/6/


More information about the TYPO3-english mailing list