note 55687 added to function.imagettftext

From: Date: Wed, 10 Aug 2005 16:05:41 +0000
Subject: note 55687 added to function.imagettftext
Groups: php.notes 
Request: Send a blank email to php-notes+get-93381@lists.php.net to get a copy of this message
Hi all! When my hoster updated his php's libs at first minutes i've got the same problem as some of you. Php couldn't find the path to true type fonts. The solution in my case was to make the path look like this <?php imagettftext($im, 20, 0, 620, 260, $secondary_color, "./tahoma.ttf" , "NEWS"); ?> so as you can see i simply added "./" another tip that i wanted to add here is how to write in RUssian on image using imagettftext you simply have to change the function argument like this <?php imagettftext($im, 15, 0, 575, 300, $secondary_color, "./tahoma.ttf" , win2uni("some word in russian")); ?> where win2uni is the function that converts win1251 to unicode. here is the code of it <?php // Windows 1251 -> Unicode function win2uni($s) { $s = convert_cyr_string($s,'w','i'); // win1251 -> iso8859-5 // iso8859-5 -> unicode: for ($result='', $i=0; $i<strlen($s); $i++) { $charcode = ord($s[$i]); $result .= ($charcode>175)?"&#".(1040+($charcode-176)).";":$s[$i]; } return $result; } ?> That's all today! Thanks for your attention! Alex ---- Manual Page -- http://www.php.net/manual/en/function.imagettftext.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+55687 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55687&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55687&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55687&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55687&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55687&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55687&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+55687&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#93381) next »