TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Frontend\Imaging\GifBuilder Class Reference
Inheritance diagram for TYPO3\CMS\Frontend\Imaging\GifBuilder:
TYPO3\CMS\Core\Imaging\GraphicalFunctions

Public Member Functions

 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)
 
 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=[], $mustCreate=false)
 
 getImageDimensions ($imageFile)
 
 getImageScale ($info, $w, $h, $options)
 
 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)
 
 getTemporaryImageWithText ($filename, $textline1, $textline2, $textline3)
 

Public Attributes

 $im = ''
 
 $w = 0
 
 $h = 0
 
 $map
 
 $workArea
 
 $setup = []
 
 $combinedTextStrings = []
 
 $combinedFileNames = []
 
 $data = []
 
 $objBB = []
 
 $myClassName = 'gifbuilder'
 
 $charRangeMap = []
 
 $XY = []
 
 $OFFSET = []
 
 $cObj
 
 $defaultWorkArea = []
 
- Public Attributes inherited from TYPO3\CMS\Core\Imaging\GraphicalFunctions
 $noFramePrepended = 0
 
 $gifExtension = 'gif'
 
 $gdlibExtensions = ''
 
 $png_truecolor = false
 
 $truecolorColors = 16777215
 
 $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 = []
 
 $workArea = []
 
 $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)
 
 generateCacheKeyForImageFile ($filePath)
 
 generateStatusHashForImageFile ($filePath)
 

Additional Inherited Members

- Static Public Member Functions inherited from TYPO3\CMS\Core\Imaging\GraphicalFunctions
static gifCompress ($theFile, $type)
 
static pngToGifByImagemagick ($theFile)
 
static readPngGif ($theFile, $output_png=false)
 
- 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(::class); $gifCreator->init(); $theImage=''; if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib']) { $gifCreator->start($fileArray, $this->data); $theImage = $gifCreator->gifBuild(); } return $gifCreator->getImageDimensions($theImage);

Definition at line 49 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

Definition at line 691 of file GifBuilder.php.

References TYPO3\CMS\Frontend\Imaging\GifBuilder\$cObj, 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().

◆ 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 843 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
int The maxium value of the given comma separated and calculated values

Definition at line 859 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
int The calculated value (e.g. "23")
See also
calcOffset()

Definition at line 794 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
TemplateService::getFileName()

Definition at line 734 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

Definition at line 593 of file GifBuilder.php.

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

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

◆ extension()

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

Returns the file extension used in the filename

Returns
string Extension; "jpg" or "gif"/"png private

Definition at line 768 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()

Definition at line 388 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()

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

Member Data Documentation

◆ $charRangeMap

TYPO3\CMS\Frontend\Imaging\GifBuilder::$charRangeMap = []

Definition at line 125 of file GifBuilder.php.

◆ $cObj

TYPO3\CMS\Frontend\Imaging\GifBuilder::$cObj

◆ $combinedFileNames

TYPO3\CMS\Frontend\Imaging\GifBuilder::$combinedFileNames = []

Definition at line 103 of file GifBuilder.php.

◆ $combinedTextStrings

TYPO3\CMS\Frontend\Imaging\GifBuilder::$combinedTextStrings = []

Definition at line 96 of file GifBuilder.php.

◆ $data

TYPO3\CMS\Frontend\Imaging\GifBuilder::$data = []

Definition at line 110 of file GifBuilder.php.

◆ $defaultWorkArea

TYPO3\CMS\Frontend\Imaging\GifBuilder::$defaultWorkArea = []

Definition at line 145 of file GifBuilder.php.

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

◆ $h

TYPO3\CMS\Frontend\Imaging\GifBuilder::$h = 0

Definition at line 70 of file GifBuilder.php.

◆ $im

TYPO3\CMS\Frontend\Imaging\GifBuilder::$im = ''

Definition at line 56 of file GifBuilder.php.

◆ $map

TYPO3\CMS\Frontend\Imaging\GifBuilder::$map

Definition at line 77 of file GifBuilder.php.

◆ $myClassName

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

Definition at line 120 of file GifBuilder.php.

◆ $objBB

TYPO3\CMS\Frontend\Imaging\GifBuilder::$objBB = []

Definition at line 115 of file GifBuilder.php.

◆ $OFFSET

TYPO3\CMS\Frontend\Imaging\GifBuilder::$OFFSET = []

Definition at line 135 of file GifBuilder.php.

◆ $setup

TYPO3\CMS\Frontend\Imaging\GifBuilder::$setup = []

Definition at line 89 of file GifBuilder.php.

◆ $w

TYPO3\CMS\Frontend\Imaging\GifBuilder::$w = 0

Definition at line 63 of file GifBuilder.php.

◆ $workArea

TYPO3\CMS\Frontend\Imaging\GifBuilder::$workArea

Definition at line 82 of file GifBuilder.php.

◆ $XY

TYPO3\CMS\Frontend\Imaging\GifBuilder::$XY = []

Definition at line 130 of file GifBuilder.php.

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