Menu


How can i generate an image using Gifbuilder from my extension



In order to generate a text as an image from your extension you need to initialize first the gifbuilder with the following code

$this->gifCreator = t3lib_div::makeInstance('tslib_gifBuilder');
$this->gifCreator->init();


This is absolutely necessary in order to generate the images.

Next you provide a configuration array for the gifbuilder and then you output the image. Here is the full code snippet:

$this->gifCreator = t3lib_div::makeInstance('tslib_gifBuilder');
$this->gifCreator->init();

$conf=array(
        'XY' => '[10.w]+10 ,20',
	'transparentBackground' => '1',
	'backColor' =>'#ECECEC',
	'10' => 'TEXT',
	'10.'=> array(
	    'text' => 'The text to be generated as an image',
	    'fontSize' => '15',
            'fontFile' => 'fileadmin/templates/font/arial.ttf',
            'fontColor' => '#909090',
            'offset' => '0,17'
	 ),
);
				
$this->gifCreator->start($conf,$data);
$mytitle='<img src="'.$this->gifCreator->gifBuild().'">';








Google Search

 
wiki.lacisoft.com
WWW
2009-2011 (c) Lacisoft.com