note 81089 deleted from function.imagettftext by nlopess

From: Date: Wed, 13 Feb 2008 22:55:35 +0000
Subject: note 81089 deleted from function.imagettftext by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-136126@lists.php.net to get a copy of this message
Note Submitter: m0r1arty at mail dot ru ---- 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');

« previous php.notes (#136126) next »