|
Prev: session ok? [SOLVED]
Next: PHP 4.4.9RC1
From: Lou Baccari on 21 Jul 2008 13:14 > 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); > ?> > >
From: Lou Baccari on 25 Jul 2008 08:50 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); >> ?> >> >> >
From: Lou Baccari on 25 Jul 2008 10:02 Sorry for the additional mail but I found the variable GDFONTPATH should be GD_FONTPATH, the example below works for me now. putenv('GD_FONTPATH=' . realpath('.')); Lou Baccari wrote: > > 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); >>> ?> >>> >>> >> >
From: "Daniel Brown" on 25 Jul 2008 10:32 On Mon, Jul 21, 2008 at 1:14 PM, Lou Baccari <baccari(a)merl.com> 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. Lou, I'm glad you solved the problem, but for whatever reason (I'm not sure about anyone else, just my own experience), all three messages just came through this morning. Did you actually send this first message on Monday, or was there a date issue with your client or server? -- </Daniel P. Brown> Better prices on dedicated servers: Intel 2.4GHz/60GB/512MB/2TB $49.99/mo. Intel 3.06GHz/80GB/1GB/2TB $59.99/mo. Dedicated servers, VPS, and hosting from $2.50/mo.
From: Lou Baccari on 25 Jul 2008 11:02
Thanks for the reply, I felt a little lonely since no one responded earlier. No one else that I've been in contact with have complained about date/time issues with my client and any emails. Yes I sent my first email on Monday, 7/21/08, and then I sent the last two messages today. The first one today looking for help and then the second one providing the solution. Lou. Daniel Brown wrote: > On Mon, Jul 21, 2008 at 1:14 PM, Lou Baccari <baccari(a)merl.com> 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. >>> > > Lou, > > I'm glad you solved the problem, but for whatever reason (I'm not > sure about anyone else, just my own experience), all three messages > just came through this morning. Did you actually send this first > message on Monday, or was there a date issue with your client or > server? > > |