From:             choinet at rocketmail dot com
Operating system: Windows XP
PHP version:      4.3.4
PHP Bug Type:     *Graphics related
Bug description:  imagettfbbox() & imagettftext() fontfile does not allow relative path

Description:
------------
array imagettfbbox ( int size, int angle, string fontfile, string text)

This is the prototype for the imagettfbbox() function, and the fontfile
argument is the same for the imagettftext() function. On Windows, there is
a problem with using relative paths to the fontfile. Full absolute
pathname must be used.

On Linux systems, however, both absolute and relative pathnames to the
fontfile are allowed.

In addition, the absolute pathname to the fontfile must have no spaces in
it, and pathnames that do have spaces must use the DOS naming convention
(e.g. C:\Progra~1\Apache~1\apache2\arial.ttf). This can become quite
annoying.

So in summary, the imagettfbbox() and imagettftext() do not allow relative
paths to the fontfile, and do not allow spaces in the paths, either, on
Windows. I did not have this problem before in the summertime when I used
an earlier release of PHP 4.

Reproduce code:
---------------
[text.php]
<?php
$fp = imagecreate(300, 100);
$color1 = imagecolorallocate($fp, 255, 255, 255);
$color2 = imagecolorallocate($fp, 0, 0, 153);
$path = 'arial.ttf';
imagettftext($fp, 12, 0, 50, 35, $color2, $path, 'test');
?>

the arial true-type font file is in the same directory as text.php.

Expected result:
----------------
I expect to see a white image with the blue text saying 'test.'

Actual result:
--------------
Warning: imagettftext(): Could not find/open font in C:\Program
Files\Apache Group\Apache2\htdocs\text.php on line 5

-- 
Edit bug report at http://bugs.php.net/?id=26635&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=26635&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=26635&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=26635&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=26635&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=26635&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=26635&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=26635&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=26635&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=26635&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=26635&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=26635&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=26635&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26635&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=26635&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=26635&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=26635&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26635&r=float

Reply via email to