TYPO3  7.6
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
GifBuilder Class Reference
Inheritance diagram for GifBuilder:
GraphicalFunctions

Public Member Functions

 gifBuild ()
 
 make ()
 
 checkTextObj ($conf)
 
 calcOffset ($string)
 
 checkFile ($file)
 
 extension ()
 
- Public Member Functions inherited from 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=array(), $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 = array()
 
 $combinedTextStrings = array()
 
 $combinedFileNames = array()
 
 $data = array()
 
 $objBB = array()
 
 $myClassName = 'gifbuilder'
 
 $charRangeMap = array()
 
 $XY = array()
 
 $OFFSET = array()
 
 $cObj
 
 $defaultWorkArea = array()
 
- Public Attributes inherited from 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 = 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 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 GraphicalFunctions
static gifCompress ($theFile, $type)
 
static pngToGifByImagemagick ($theFile)
 
static readPngGif ($theFile, $output_png=false)
 
- Protected Attributes inherited from 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 48 of file GifBuilder.php.

Member Function Documentation

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 690 of file GifBuilder.php.

References GifBuilder\calculateFunctions(), GifBuilder\calculateValue(), and GeneralUtility\trimExplode().

Referenced by GifBuilder\calculateMaximum().

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 839 of file GifBuilder.php.

References GifBuilder\calculateMaximum().

Referenced by GifBuilder\calcOffset().

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 855 of file GifBuilder.php.

References GifBuilder\calcOffset(), and GeneralUtility\trimExplode().

Referenced by GifBuilder\calculateFunctions().

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 790 of file GifBuilder.php.

References elseif, and GeneralUtility\splitCalc().

Referenced by GifBuilder\calcOffset().

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 733 of file GifBuilder.php.

References $GLOBALS.

Referenced by GifBuilder\checkTextObj().

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 592 of file GifBuilder.php.

References GifBuilder\$cObj, GifBuilder\checkFile(), and GeneralUtility\makeInstance().

Referenced by GifBuilder\make().

extension ( )

Returns the file extension used in the filename

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

Definition at line 764 of file GifBuilder.php.

References GraphicalFunctions\$gifExtension.

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 387 of file GifBuilder.php.

References GraphicalFunctions\createTempSubDir(), GraphicalFunctions\destroy(), GifBuilder\make(), and GraphicalFunctions\output().

make ( )

Member Data Documentation

$charRangeMap = array()

Definition at line 124 of file GifBuilder.php.

$cObj

Definition at line 139 of file GifBuilder.php.

Referenced by GifBuilder\checkTextObj().

$combinedFileNames = array()

Definition at line 102 of file GifBuilder.php.

$combinedTextStrings = array()

Definition at line 95 of file GifBuilder.php.

$data = array()

Definition at line 109 of file GifBuilder.php.

$defaultWorkArea = array()

Definition at line 144 of file GifBuilder.php.

Referenced by GifBuilder\make().

$h = 0

Definition at line 69 of file GifBuilder.php.

$im = ''

Definition at line 55 of file GifBuilder.php.

$map

Definition at line 76 of file GifBuilder.php.

$myClassName = 'gifbuilder'

Definition at line 119 of file GifBuilder.php.

$objBB = array()

Definition at line 114 of file GifBuilder.php.

$OFFSET = array()

Definition at line 134 of file GifBuilder.php.

$setup = array()

Definition at line 88 of file GifBuilder.php.

$w = 0

Definition at line 62 of file GifBuilder.php.

$workArea

Definition at line 81 of file GifBuilder.php.

$XY = array()

Definition at line 129 of file GifBuilder.php.

Referenced by GifBuilder\make().