note 27335 modified in function.imagettftext by aidan

From: Date: Mon, 20 Sep 2004 10:52:58 +0000
Subject: note 27335 modified in function.imagettftext by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-77045@lists.php.net to get a copy of this message
If you have an older version of the GD library, but wish to use a font file which has spaces in the path, you should convert the path into DOS style names. This will only work on windows. For example: C:\reallylongpath\reallylongpath\font.ttf Would become: C:\really~1\really~1\font.ttf --was-- Hello people, finally I FOUND the solution for TFF fonts and GD the problem is path to font, when path contains long file names like Program Files\Apache group\Apache..... I wrote a litle func to convert long file names into short(8.3) and GD works fine now!!! so here a little example how to convert path into 8.3 format so GD can understand it. ----------------------------------------------------------- function convert16($s) { if (strlen($s) > 8) { $p = pathinfo($s); $ss = substr(str_replace('.','',$s),0,6); $s = $ss.'~1'; if($p['extension']) $s .= '.'.$p['extension']; } return $s; } function convertpath($path) { $pathinfo = pathinfo($path); $dirname = split("/",$pathinfo['dirname']); $res = ''; foreach ($dirname as $dir) { $res .= convert16($dir).'\\'; } return $res.$pathinfo['basename']; } ---------------------------------------------------------- ok, good luck!! http://php.net/manual/en/function.imagettftext.php

« previous php.notes (#77045) next »