php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16300 PNG generation w/ TTF Font loading works from cmd line but fails from http
Submitted: 2002-03-26 23:21 UTC Modified: 2002-04-28 00:00 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: shamim at poetryunlimited dot com Assigned:
Status: No Feedback Package: GD related
PHP Version: 4.1.2 OS: Linux-Mandrake 8.2
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2002-03-26 23:21 UTC] shamim at poetryunlimited dot com
Running Linux-Mandrake 8.2 on Duron 700 266 FSB w/ php 4.1.2 and Zend engine optimized to 65535 (pass 9 and 10 and 11)

Installed:
apache-conf-1.3.23-4mdk
apache-suexec-1.3.23-3mdk
apache-modules-1.3.23-4mdk
apache-mod_perl-1.3.23_1.26-5mdk
apache-manual-1.3.23-4mdk
apache-devel-1.3.23-4mdk
apache-1.3.23-4mdk
apache-common-1.3.23-4mdk
apache-source-1.3.20-3mdk
php-imap-4.1.2-1mdk
php-manual_en-4.1.1-1mdk
php-xml-4.1.2-1mdk
php-common-4.1.2-1mdk
php-mysql-4.1.2-2mdk
php-readline-4.1.2-1mdk
php-4.1.2-1mdk
php-dba_gdbm_db3-4.1.2-1mdk
php-ldap-4.1.2-1mdk
php-gd-4.1.2-1mdk
php-pgsql-4.1.2-1mdk
mod_php-4.1.2-1mdk
php-devel-4.1.2-1mdk
libgd1-devel-1.8.4-4mdk
libgd1-1.8.4-4mdk
freetype-tools-1.3.1-12mdk
freetype-1.3.1-12mdk
freetype-devel-1.3.1-12mdk
freetype2-2.0.4-1mdk
freetype2-devel-2.0.4-1mdk

http://reality.poetryunlimited.com:81/testvars - list of php settings and modules

http://new.poetryunlimited.com:81/testbug.php3 -fails miserably.

php testbug.php3 generates image perfectly. Copy of saved image located at http://new.poetryunlimited.com:81/images/myimg.png

Font directory cannot even be relative or font loading fails - preferred earlier GD preferences - where can we set the GDFONTPATH env variable per server? Can we use a full path outside of the apache tree???

Any font file can be used in place of the ttf I have placed below. If the ttf is requried it can be retrieved from http://new.poetryunlimited.com:81/font/bluebold.ttf

testbug.php3 follows

<?php
$imagewidth = 100;
$imageheight = 20;
$fontsize = 12;
$myimg=ImageCreate($imagewidth, $imageheight);
$col1=ImageColorAllocate($myimg, 255, 0, 0);
$col2=ImageColorAllocate($myimg, 255, 255, 255);
$thetextbox = ImageTTFBBox ($fontsize, 0,
"/home/httpd/html/new/font/bluebold.ttf", "My Button");
$textwidth = (($thetextbox[4] + $thetextbox[2]) / 2) - (($thetextbox[6] +
$thetextbox[0]) / 2);
$xpos = ($imagewidth - $textwidth) / 2;
$ypos = 14;
ImageTTFText ($myimg, $fontsize, 0, $xpos, $ypos, $col2,
"/home/httpd/html/new/font/bluebold.ttf", "My Button");
ImagePNG($myimg, "myimg.png");
ImageDestroy($myimg);
?>
<img src="myimg.png" border=0>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-27 14:06 UTC] shamim at poetryunlimited dot com
From HTTP this test process segfaults every time under mod_php4. Succeeds in running test only on command line.

Also, running Zend optimizer 1.2.0.
 [2002-03-27 14:07 UTC] shamim at poetryunlimited dot com
If this is unclear, under mod_php4, this process segfaults every time. Even w/ the simplest ImageTTF* call.
 [2002-03-27 14:47 UTC] mfischer@php.net
a) do not complain distribution packages, only roll your own php installation from source
b) disable everything but necessary things (read: php4 and gd)
c) if a crash, please probide a backtrace
 [2002-04-28 00:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 15:01:29 2024 UTC