TYPO3 CMS  TYPO3_6-2
TYPO3\CMS\Frontend\Imaging\GifBuilder Class Reference
Inheritance diagram for TYPO3\CMS\Frontend\Imaging\GifBuilder:
TYPO3\CMS\Core\Imaging\GraphicalFunctions tslib_gifBuilder

Public Member Functions

 start ($conf, $data)
 
 gifBuild ()
 
 make ()
 
 checkTextObj ($conf)
 
 calcOffset ($string)
 
 checkFile ($file)
 
 extension ()
 
- Public Member Functions inherited from TYPO3\CMS\Core\Imaging\GraphicalFunctions
 init ()
 
 maskImageOntoImage (&$im, $conf, $workArea)
 
 copyImageOntoImage (&$im, $conf, $workArea)
 
 copyGifOntoGif (&$im, $cpImg, $conf, $workArea)
 
 imagecopyresized (&$dstImg, $srcImg, $dstX, $dstY, $srcX, $srcY, $dstWidth, $dstHeight, $srcWidth, $srcHeight)
 
 makeText (&$im, $conf, $workArea)
 
 txtPosition ($conf, $workArea, $BB)
 
 calcBBox ($conf)
 
 addToMap ($cords, $conf)
 
 calcTextCordsForMap ($cords, $offset, $conf)
 
 SpacedImageTTFText (&$im, $fontSize, $angle, $x, $y, $Fcolor, $fontFile, $text, $spacing, $wordSpacing, $splitRenderingConf, $sF=1)
 
 fontResize ($conf)
 
 ImageTTFBBoxWrapper ($fontSize, $angle, $fontFile, $string, $splitRendering, $sF=1)
 
 ImageTTFTextWrapper ($im, $fontSize, $angle, $x, $y, $color, $fontFile, $string, $splitRendering, $sF=1)
 
 splitString ($string, $splitRendering, $fontSize, $fontFile)
 
 calcWordSpacing ($conf, $scaleFactor=1)
 
 getTextScalFactor ($conf)
 
 makeOutline (&$im, $conf, $workArea, $txtConf)
 
 circleOffset ($distance, $iterations)
 
 makeEmboss (&$im, $conf, $workArea, $txtConf)
 
 makeShadow (&$im, $conf, $workArea, $txtConf)
 
 makeBox (&$im, $conf, $workArea)
 
 makeEllipse (&$im, array $conf, array $workArea)
 
 makeEffect (&$im, $conf)
 
 IMparams ($setup)
 
 adjust (&$im, $conf)
 
 crop (&$im, $conf)
 
 scale (&$im, $conf)
 
 setWorkArea ($workArea)
 
 autolevels (&$im)
 
 outputLevels (&$im, $low, $high, $swap='')
 
 inputLevels (&$im, $low, $high, $swap='')
 
 IMreduceColors ($file, $cols)
 
 prependAbsolutePath ($fontFile)
 
 v5_sharpen ($factor)
 
 v5_blur ($factor)
 
 randomName ()
 
 applyOffset ($cords, $OFFSET)
 
 convertColor ($string)
 
 recodeString ($string)
 
 singleChars ($theText, $returnUnicodeNumber=FALSE)
 
 objPosition ($conf, $workArea, $BB)
 
 imageMagickConvert ($imagefile, $newExt='', $w='', $h='', $params='', $frame='', $options=array(), $mustCreate=FALSE)
 
 getImageDimensions ($imageFile)
 
 cacheImageDimensions ($identifyResult)
 
 getCachedImageDimensions ($imageFile)
 
 getImageScale ($info, $w, $h, $options)
 
 file_exists_typo3temp_file ($output, $orig='')
 
 imageMagickIdentify ($imagefile)
 
 imageMagickExec ($input, $output, $params, $frame=0)
 
 combineExec ($input, $overlay, $mask, $output, $handleNegation=FALSE)
 
 checkFile ($file)
 
 createTempSubDir ($dirName)
 
 applyImageMagickToPHPGif (&$im, $command)
 
 gif_or_jpg ($type, $w, $h)
 
 output ($file)
 
 destroy ()
 
 imgTag ($imgInfo)
 
 ImageWrite ($destImg, $theImage, $quality=0)
 
 imageCreateFromFile ($sourceImg)
 
 hexColor ($col)
 
 unifyColors (&$img, $colArr, $closest=FALSE)
 

Public Attributes

 $im = ''
 
 $w = 0
 
 $h = 0
 
 $map
 
 $workArea
 
 $setup = array()
 
 $combinedTextStrings = array()
 
 $combinedFileNames = array()
 
 $data = array()
 
 $objBB = array()
 
 $myClassName = 'gifbuilder'
 
 $charRangeMap = array()
 
- Public Attributes inherited from TYPO3\CMS\Core\Imaging\GraphicalFunctions
 $noFramePrepended = 0
 
 $gifExtension = 'gif'
 
 $gdlibExtensions = ''
 
 $png_truecolor = FALSE
 
 $truecolorColors = 16777215
 
 $enable_typo3temp_db_tracking = 0
 
 $imageFileExt = 'gif,jpg,jpeg,png,tif,bmp,tga,pcx,ai,pdf'
 
 $webImageExt = 'gif,jpg,jpeg,png'
 
 $NO_IM_EFFECTS = ''
 
 $cmds
 
 $NO_IMAGE_MAGICK = ''
 
 $V5_EFFECTS = 0
 
 $mayScaleUp = 1
 
 $filenamePrefix = ''
 
 $imageMagickConvert_forceFileNameBody = ''
 
 $dontCheckForExistingTempFile = 0
 
 $dontCompress = 0
 
 $dontUnlinkTempFiles = 0
 
 $alternativeOutputKey = ''
 
 $IM_commands = array()
 
 $workArea = array()
 
 $tempPath = 'typo3temp/'
 
 $absPrefix = ''
 
 $scalecmd = '-geometry'
 
 $im5fx_blurSteps = '1x2,2x2,3x2,4x3,5x3,5x4,6x4,7x5,8x5,9x5'
 
 $im5fx_sharpenSteps = '1x2,2x2,3x2,2x3,3x3,4x3,3x4,4x4,4x5,5x5'
 
 $pixelLimitGif = 10000
 
 $colMap
 
 $csConvObj
 
 $nativeCharset = ''
 

Protected Member Functions

 calculateValue ($string)
 
 calculateFunctions ($string)
 
 calculateMaximum ($string)
 
- Protected Member Functions inherited from TYPO3\CMS\Core\Imaging\GraphicalFunctions
 renderTTFText (&$im, $fontSize, $angle, $x, $y, $color, $fontFile, $string, $splitRendering, $conf, $sF=1)
 
 getWordPairsForLineBreak ($string)
 
 getRenderedTextWidth ($text, $conf)
 
 getBreakSpace ($conf, array $boundingBox=NULL)
 
 wrapFileName ($inputName)
 

Additional Inherited Members

- Protected Attributes inherited from TYPO3\CMS\Core\Imaging\GraphicalFunctions
 $colorspace = 'RGB'
 
 $allowedColorSpaceNames
 
 $saveAlphaLayer = FALSE
 

Detailed Description

GIFBUILDER

Generating gif/png-files from TypoScript Used by the menu-objects and imgResource in TypoScript.

This class allows for advanced rendering of images with various layers of images, text and graphical primitives. The concept is known from TypoScript as "GIFBUILDER" where you can define a "numerical array" (TypoScript term as well) of "GIFBUILDER OBJECTS" (like "TEXT", "IMAGE", etc.) and they will be rendered onto an image one by one. The name "GIFBUILDER" comes from the time where GIF was the only file format supported. PNG is just as well to create today (configured with TYPO3_CONF_VARS[GFX]) Not all instances of this class is truely building gif/png files by layers; You may also see the class instantiated for the purpose of using the scaling functions in the parent class.

Here is an example of how to use this class (from tslib_content.php, function getImgResource):

$gifCreator = GeneralUtility::makeInstance('TYPO3\CMS\Frontend\Imaging\GifBuilder'); $gifCreator->init(); $theImage=''; if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib']) { $gifCreator->start($fileArray, $this->data); $theImage = $gifCreator->gifBuild(); } return $gifCreator->getImageDimensions($theImage);

Author
Kasper Skårhøj kaspe.nosp@m.rYYY.nosp@m.Y@typ.nosp@m.o3.c.nosp@m.om

Definition at line 43 of file GifBuilder.php.

Member Function Documentation

◆ calcOffset()

TYPO3\CMS\Frontend\Imaging\GifBuilder::calcOffset (   $string)

Calculation of offset using "splitCalc" and insertion of dimensions from other GIFBUILDER objects.

Example: Input: 2+2, 2*3, 123, [10.w] Output: 4,6,123,45 (provided that the width of object in position 10 was 45 pixels wide)

Parameters
string$stringThe string to resolve/calculate the result of. The string is divided by a comma first and each resulting part is calculated into an integer.
Returns
string The resolved string with each part (separated by comma) returned separated by comma private
Todo:
Define visibility

Definition at line 652 of file GifBuilder.php.

References TYPO3\CMS\Core\Imaging\GraphicalFunctions\$gifExtension, TYPO3\CMS\Frontend\Imaging\GifBuilder\calculateFunctions(), TYPO3\CMS\Frontend\Imaging\GifBuilder\calculateValue(), TYPO3\CMS\Core\Utility\GeneralUtility\inList(), TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance(), and TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

Referenced by TYPO3\CMS\Frontend\Imaging\GifBuilder\calculateMaximum(), and TYPO3\CMS\Frontend\Imaging\GifBuilder\start().

◆ calculateFunctions()

TYPO3\CMS\Frontend\Imaging\GifBuilder::calculateFunctions (   $string)
protected

Calculates special functions:

  • max([10.h], [20.h]) -> gets the maximum of the given values
Parameters
string$stringThe raw string with functions to be calculated
Returns
string The calculated values

Definition at line 811 of file GifBuilder.php.

References TYPO3\CMS\Frontend\Imaging\GifBuilder\calculateMaximum().

Referenced by TYPO3\CMS\Frontend\Imaging\GifBuilder\calcOffset().

◆ calculateMaximum()

TYPO3\CMS\Frontend\Imaging\GifBuilder::calculateMaximum (   $string)
protected

Calculates the maximum of a set of values defined like "[10.h],[20.h],1000"

Parameters
string$stringThe string to be used to calculate the maximum (e.g. "[10.h],[20.h],1000")
Returns
integer The maxium value of the given comma separated and calculated values

Definition at line 826 of file GifBuilder.php.

References TYPO3\CMS\Frontend\Imaging\GifBuilder\calcOffset(), and TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

Referenced by TYPO3\CMS\Frontend\Imaging\GifBuilder\calculateFunctions().

◆ calculateValue()

TYPO3\CMS\Frontend\Imaging\GifBuilder::calculateValue (   $string)
protected

Calculates the value concerning the dimensions of objects.

Parameters
string$stringThe string to be calculated (e.g. "[20.h]+13")
Returns
integer The calculated value (e.g. "23")
See also
calcOffset()

Definition at line 763 of file GifBuilder.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\splitCalc().

Referenced by TYPO3\CMS\Frontend\Imaging\GifBuilder\calcOffset().

◆ checkFile()

TYPO3\CMS\Frontend\Imaging\GifBuilder::checkFile (   $file)

Returns the reference to a "resource" in TypoScript.

Parameters
string$fileThe resource value.
Returns
string Returns the relative filepath private
See also
::getFileName()
Todo:
Define visibility

Definition at line 695 of file GifBuilder.php.

References $GLOBALS, TYPO3\CMS\Frontend\Imaging\GifBuilder\extension(), TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance(), and TYPO3\CMS\Core\Utility\GeneralUtility\shortMD5().

Referenced by TYPO3\CMS\Frontend\Imaging\GifBuilder\checkTextObj().

◆ checkTextObj()

TYPO3\CMS\Frontend\Imaging\GifBuilder::checkTextObj (   $conf)

Initializing/Cleaning of TypoScript properties for TEXT GIFBUILDER objects

'cleans' TEXT-object; Checks fontfile and other vital setup Finds the title if its a 'variable' (instantiates a cObj and loads it with the ->data record) Performs caseshift if any.

Parameters
array$confGIFBUILDER object TypoScript properties
Returns
array Modified $conf array IF the "text" property is not blank private
Todo:
Define visibility

Definition at line 555 of file GifBuilder.php.

References TYPO3\CMS\Frontend\Imaging\GifBuilder\checkFile(), and TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

Referenced by TYPO3\CMS\Frontend\Imaging\GifBuilder\make(), and TYPO3\CMS\Frontend\Imaging\GifBuilder\start().

◆ extension()

TYPO3\CMS\Frontend\Imaging\GifBuilder::extension ( )

Returns the file extension used in the filename

Returns
string Extension; "jpg" or "gif"/"png private
Todo:
Define visibility

Definition at line 738 of file GifBuilder.php.

References TYPO3\CMS\Core\Imaging\GraphicalFunctions\$gifExtension.

Referenced by TYPO3\CMS\Frontend\Imaging\GifBuilder\checkFile().

◆ gifBuild()

TYPO3\CMS\Frontend\Imaging\GifBuilder::gifBuild ( )

Initiates the image file generation if ->setup is TRUE and if the file did not exist already. Gets filename from fileName() and if file exists in typo3temp/ dir it will - of course - not be rendered again. Otherwise rendering means calling ->make(), then ->output(), then ->destroy()

Returns
string The filename for the created GIF/PNG file. The filename will be prefixed "GB_
See also
make(), fileName()
Todo:
Define visibility

Definition at line 352 of file GifBuilder.php.

References TYPO3\CMS\Core\Imaging\GraphicalFunctions\createTempSubDir(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\destroy(), TYPO3\CMS\Frontend\Imaging\GifBuilder\make(), and TYPO3\CMS\Core\Imaging\GraphicalFunctions\output().

◆ make()

◆ start()

TYPO3\CMS\Frontend\Imaging\GifBuilder::start (   $conf,
  $data 
)

Initialization of the GIFBUILDER objects, in particular TEXT and IMAGE. This includes finding the bounding box, setting dimensions and offset values before the actual rendering is started. Modifies the ->setup, ->objBB internal arrays Should be called after the ->init() function which initializes the parent class functions/variables in general. The class also uses gifbuilder and here there is an interesting use since the function findLargestDims() from that class calls the init() and start() functions to find the total dimensions before starting the rendering of the images.

Parameters
array$confTypoScript properties for the GIFBUILDER session. Stored internally in the variable ->setup
array$dataThe current data record from . Stored internally in the variable ->data
Returns
void
See also
::getImgResource(), ::makeGifs(), ::findLargestDims()
Todo:
Define visibility

Definition at line 126 of file GifBuilder.php.

References TYPO3\CMS\Frontend\Imaging\GifBuilder\$data, $GLOBALS, TYPO3\CMS\Frontend\Imaging\GifBuilder\$setup, TYPO3\CMS\Frontend\Imaging\GifBuilder\$workArea, TYPO3\CMS\Core\Imaging\GraphicalFunctions\calcBBox(), TYPO3\CMS\Frontend\Imaging\GifBuilder\calcOffset(), TYPO3\CMS\Core\Utility\GeneralUtility\callUserFunction(), TYPO3\CMS\Frontend\Imaging\GifBuilder\checkTextObj(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\fontResize(), TYPO3\CMS\Core\Utility\MathUtility\forceIntegerInRange(), TYPO3\CMS\Core\Utility\GeneralUtility\intExplode(), TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\setWorkArea(), and TYPO3\CMS\Core\TypoScript\TemplateService\sortedKeyList().

Member Data Documentation

◆ $charRangeMap

TYPO3\CMS\Frontend\Imaging\GifBuilder::$charRangeMap = array()
Todo:
Define visibility

Definition at line 112 of file GifBuilder.php.

◆ $combinedFileNames

TYPO3\CMS\Frontend\Imaging\GifBuilder::$combinedFileNames = array()
Todo:
Define visibility

Definition at line 91 of file GifBuilder.php.

◆ $combinedTextStrings

TYPO3\CMS\Frontend\Imaging\GifBuilder::$combinedTextStrings = array()
Todo:
Define visibility

Definition at line 85 of file GifBuilder.php.

◆ $data

TYPO3\CMS\Frontend\Imaging\GifBuilder::$data = array()
Todo:
Define visibility

Definition at line 97 of file GifBuilder.php.

Referenced by TYPO3\CMS\Frontend\Imaging\GifBuilder\start().

◆ $h

TYPO3\CMS\Frontend\Imaging\GifBuilder::$h = 0
Todo:
Define visibility

Definition at line 62 of file GifBuilder.php.

◆ $im

TYPO3\CMS\Frontend\Imaging\GifBuilder::$im = ''
Todo:
Define visibility

Definition at line 50 of file GifBuilder.php.

◆ $map

TYPO3\CMS\Frontend\Imaging\GifBuilder::$map
Todo:
Define visibility

Definition at line 68 of file GifBuilder.php.

◆ $myClassName

TYPO3\CMS\Frontend\Imaging\GifBuilder::$myClassName = 'gifbuilder'
Todo:
Define visibility

Definition at line 107 of file GifBuilder.php.

◆ $objBB

TYPO3\CMS\Frontend\Imaging\GifBuilder::$objBB = array()
Todo:
Define visibility

Definition at line 102 of file GifBuilder.php.

◆ $setup

TYPO3\CMS\Frontend\Imaging\GifBuilder::$setup = array()
Todo:
Define visibility

Definition at line 79 of file GifBuilder.php.

Referenced by TYPO3\CMS\Frontend\Imaging\GifBuilder\start().

◆ $w

TYPO3\CMS\Frontend\Imaging\GifBuilder::$w = 0
Todo:
Define visibility

Definition at line 56 of file GifBuilder.php.

◆ $workArea

TYPO3\CMS\Frontend\Imaging\GifBuilder::$workArea
Todo:
Define visibility

Definition at line 73 of file GifBuilder.php.

Referenced by TYPO3\CMS\Frontend\Imaging\GifBuilder\start().