Skip to content

Instantly share code, notes, and snippets.

@mipmip
Created February 14, 2012 21:05
Show Gist options
  • Save mipmip/1830434 to your computer and use it in GitHub Desktop.
Save mipmip/1830434 to your computer and use it in GitHub Desktop.
TYPO3: Using GIFBUILDER from PHP
<?php
// Using GIFBUILDER from PHP
//Example of creating an image from scratch with text with some extra options
$conf = array(
'file' => 'GIFBUILDER',
'file.' => array(
'XY' => '177,212',
'backColor' => '#cecece',
'10' => 'TEXT',
'10.' => array(
'fontColor' => 'red',
'niceText' => '1',
'fontSize' => '20',
'offset' => '20,40',
'text' => 'No',
'fontFile' => 't3lib/fonts/vera.ttf'
),
'20' => 'TEXT',
'20.' => array(
'fontColor' => 'red',
'niceText' => '1',
'fontSize' => '20',
'offset' => '20,80',
'text' => 'preview',
'fontFile' => 't3lib/fonts/nimbus.ttf'
)
),
);
$preview = $this->pobj->cObj->IMG_RESOURCE($conf);
// Example of resizing an image
$prvimg='uploads/tx_p3ga/'.$row['tx_p3ga_preview_image_manual'];
if(is_file($prvimg))
{
$conf = array(
'file' => $prvimg,
'file.' => array(
'maxW' => '177',
'maxH' => '212'
),
);
$preview = $this->pobj->cObj->IMG_RESOURCE($conf);
}
//
$conf = array(
'file' => 'GIFBUILDER',
'file.' => array(
'XY' => '177,212',
'backColor' => '#cecece',
'10' => 'TEXT',
'10.' => array(
'fontColor' => 'red',
'niceText' => '1',
'fontSize' => '20',
'offset' => '20,40',
'text' => 'No',
'fontFile' => 't3lib/fonts/vera.ttf'
),
'20' => 'TEXT',
'20.' => array(
'fontColor' => 'red',
'niceText' => '1',
'fontSize' => '20',
'offset' => '20,80',
'text' => 'preview',
'fontFile' => 't3lib/fonts/nimbus.ttf'
)
),
);
$preview = $this->pobj->cObj->IMG_RESOURCE($conf);
Example of resizing an image
$prvimg='uploads/tx_p3ga/'.$row['tx_p3ga_preview_image_manual'];
if(is_file($prvimg))
{
$conf = array(
'file' => $prvimg,
'file.' => array(
'maxW' => '177',
'maxH' => '212'
),
);
$preview = $this->pobj->cObj->IMG_RESOURCE($conf);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment