note 81088 added to function.imagettftext

From: Date: Wed, 13 Feb 2008 18:50:09 +0000
Subject: note 81088 added to function.imagettftext
Groups: php.notes 
Request: Send a blank email to php-notes+get-136123@lists.php.net to get a copy of this message
Sorry my English. I have trouble with using imagettftext under Windows. I can't used short name of fonts(example "arial","arialbd.ttf" etc). PHP say what not find this font. Manipulation with environment GDFONTPATH lost. This is my solution <?php $dir=opendir('./font/');//directory with fonts if($dir) while($f=readdir($dir)){ if(preg_match('/\.ttf$/',$f)){ $font=explode('.',$f); define($font[0],realpath('./font/'.$f)); } } if($dir) closedir($dir); ?> Directory "font" have two file: arial.ttf and arialbd.ttf Now one can using constant font name by calling imagettftext: imagettftext($img,12,0,25,28,$color,arialbd,'some text'); ---- Server IP: 195.54.192.44 Probable Submitter: 78.36.178.156 ---- Manual Page -- http://www.php.net/manual/en/function.imagettftext.php Edit -- https://master.php.net/note/edit/81088 Del: integrated -- https://master.php.net/note/delete/81088/integrated Del: useless -- https://master.php.net/note/delete/81088/useless Del: bad code -- https://master.php.net/note/delete/81088/bad+code Del: spam -- https://master.php.net/note/delete/81088/spam Del: non-english -- https://master.php.net/note/delete/81088/non-english Del: in docs -- https://master.php.net/note/delete/81088/in+docs Del: other reasons-- https://master.php.net/note/delete/81088 Reject -- https://master.php.net/note/reject/81088 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#136123) next »