#26635 [Opn]: imagettfbbox() & imagettftext() fontfile does not allow relative path
| From: | choinet at rocketmail dot com | Date: | Mon, 15 Dec 2003 19:56:56 +0000 |
| Subject: | #26635 [Opn]: imagettfbbox() & imagettftext() fontfile does not allow relative path | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-52115@lists.php.net to get a copy of this message | ||
ID: 26635
User updated by: choinet at rocketmail dot com
Reported By: choinet at rocketmail dot com
Status: Open
Bug Type: *Graphics related
Operating System: Windows XP
PHP Version: 4.3.4
New Comment:
Eh, actually, I should add that in the summertime, I must have used the
path c:\Apache\htdocs\arial.tff for the fontfile, so that is why it
worked before in the summertime.
Previous Comments:
------------------------------------------------------------------------
[2003-12-15 13:22:43] choinet at rocketmail dot com
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 this bug report at http://bugs.php.net/?id=26635&edit=1