note 65460 added to function.imagettftext

From: Date: Mon, 01 May 2006 11:08:05 +0000
Subject: note 65460 added to function.imagettftext
Groups: php.notes 
Request: Send a blank email to php-notes+get-110259@lists.php.net to get a copy of this message
Another way of the bellow. After creating a child class of GMIPluggableSet class, which should override two method: getExpression() and getVariables(), throw it to a instance of FontImageGenerator class. For example, the code follows: <?php require_once 'package.fig.php'; class SampleFontImagePluggableSet extends GMIPluggableSet { var $defaultVariables = array( "text" => null, "size" => null, "font" => null, "color" => "0x000000", "alpha" => "100", "padding" => 0, "width" => null, "height" => null, "align" => "left", "valign" => "middle", "bgcolor" => "0xffffff", "antialias" => 4 ); function SampleFontImagePluggableSet() { parent::GMIPluggableSet(); } function getExpression() { return "size {width}, {height};". "autoresize none;". "type gif, 256, {color: {bgcolor}};". "padding {padding};". "color {color: {bgcolor}};". "fill;". "color {color: {color}, {alpha}};". "antialias {antialias};". "font {font}, {size};". "string {text}, 0, 0, {width}, {height}, {align}, {valign};"; } function getVariables() { return array_merge($this->defaultVariables, $_GET); } } $pluggableSet = new SampleFontImagePluggableSet(); $fig = new FontImageGenerator(); $fig->setPluggableSet($pluggableSet); $fig->execute(); ?> This output a image with the text defined in $_GET['text'], the font in $_GET['font'], the text color in $_GET['color'], the background in $_GET['bgcolor'], and so on. The script file is available at: http://sgssweb.com/experiments/?file=PHPFontImageGenerator . ---- Server IP: 66.163.161.117 Probable Submitter: 210.20.246.229 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.imagettftext.php Edit -- http://master.php.net/note/edit/65460 Del: integrated -- http://master.php.net/note/delete/65460/integrated Del: useless -- http://master.php.net/note/delete/65460/useless Del: bad code -- http://master.php.net/note/delete/65460/bad+code Del: spam -- http://master.php.net/note/delete/65460/spam Del: non-english -- http://master.php.net/note/delete/65460/non-english Del: in docs -- http://master.php.net/note/delete/65460/in+docs Del: other reasons-- http://master.php.net/note/delete/65460 Reject -- http://master.php.net/note/reject/65460 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#110259) next »