Re: PHP Warning: imagettftext()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Hello,

After reading Practical PHP Programing I came across a reference that said "On Unix machines, you may find PHP searches in /usr/share/fonts/truetype". Well I find that my php script executes successfully when I placing my arial.ttf file into /usr/share/fonts/truetype directory.

So I tried using "|putenv('GDFONTPATH=' . realpath('.'));" and "$font = dirname(__FILE__).'/arial.ttf';" and I can not over ride the GDFONTPATH from search in | /usr/share/fonts/truetype. Do I have other options that will allow me to point to the ttf file local to the php script? Is this a bug ?

Thanks,

Lou


Lou Baccari wrote:

Hello,

I'm trying to move a site over to the V5 of CentOS and I having problems with php/gd/freetype. It looks like my older systems which is running php-4.3.8-1.1, gd-2.0.15-1, freetype-2.1.4-5 can execute the code successfully.

Now when I try to execute the same code on CentOS V5 with php-5.2.6, php-gd-5.2.6, gd-2.0.33-9.4,
freetype-2.2.1-20 the same piece of code fails with the error:
" *[Mon Jul 21 13:13:11 2008] [error] [client 137.203.140.206] PHP Warning: imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not read font in /www/html/template/lou2.php on line 10 [Mon Jul 21 13:13:11 2008] [error] [client 137.203.140.206] PHP Warning: imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not read font in /www/html/template/lou2.php on line 11
**"*

I read through php.net and marc.info but I have not yet found a solution, Any ideas?

Thanks,

Lou

code ============================


<?php
//header("Content-type: image/png");
$im = imagecreate(400, 30);
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
$text = 'BBBBBBBBBBBBBBBBBBBleh...';
$font = 'arial.ttf';
putenv( 'GDFONTPATH='.realpath('.') );
imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);
imagettftext($im, 20, 0, 10, 20, $black, $font, $text);

header("Content-type: image/png");

imagepng($im);
imagedestroy($im);
?>




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux