#26635 [Opn]: imagettfbbox() & imagettftext() fontfile does not allow relative path
ID: 26635 User updated by: choinet at rocketmail dot com Reported By: choinet at rocketmail dot com Status: Open Bug Type: GD related Operating System: Windows XP PHP Version: 4CVS-2003-12-28 New Comment: eh, that hyperlink should be without the comma Previous Comments: [2003-12-28 18:25:22] choinet at rocketmail dot com What am I doing wrong, then? Here's a screenshot at http://icandy.sourceforge.net/phperror.gif, showing the script and font file in c:\htdocs and c:\htdocs\test directory, respectively, as well as the source code and the instance of the problem. The warning was generated on Windows XP and Apache2 using the latest STABLE CVS (I also checked 4.3.4, latest 5.x CVS, and 5.0.0 beta 3) [2003-12-28 14:24:51] [EMAIL PROTECTED] I have tried path with spaces in them on Windows XP and they work properly. [2003-12-26 01:34:05] choinet at rocketmail dot com When I read the previous response, I was almost completely baffled. I see two confirmations that the bug has been fixed, yet here I am at my computer with clean installs of the various PHP4,PHP4 CVS, PHP5 beta 3, and PHP5 CVS, and still have the problem. I even went to my other computer running Windows XP/Apache2/PHP to verify that I wasn't encountering an isolated problem. Still, I found it quite odd that the bug was fixed by the developers and that the bug was unreplicable. Then I remembered having to place NetPBM binaries in a directory like "c:\netpbm" without any spaces in the pathname in order for a php-powered gallery application to recognize them. I decided to try the same thing with the Apache DocumentRoot directive and set it to the location of a copy of the test script, "C:/htdocs", instead of the usual "C:/Program Files/Apache Group/Apache2/htdocs". After restarting the server, the pathnames worked fine just like Iliaa described. So, I found that the culprit (spaces in the pathname) affected not only the absolute pathnames but the relative ones as well. For the absolute pathnames, if they contain spaces, the same error in opening the font will occur. This can only be remedied by using the MS-DOS 8.3 convention, e.g. "C:/Progra~1/Apache~1/Apache2/htdocs/arial.ttf" as aforementioned. However, there is no such alternative for Linux pathnames with spaces in them. Furthermore, concerning relative pathnames, which much of the responses have been centered around: the fonts work as intended when called as 'arial', 'arial.ttf', and so on only if the directory containing them has no spaces in its pathname. I'm not sure why the naming format of the parent directories affects the relative pathname, but it somehow does. That is why the two gd functions work only when the font file is located in a pathname without spaces (c:\htdocs) and does not for the other (c:\Program Files\Apache Group\Apache2\htdocs). So, I think that the problem of spaces is affecting all of the other remaining issues. I am assuming that the developers reported no problems on the Windows setup because the http document root's or the fontfile's pathname had no spaces. The thing is, the Apache webserver installs by default at "c:\Program Files\Apache Group", so the DocumentRoot will still generate this error. Sorry for making this report seem long and drawn out, but the problem has finally been pinpointed after much obfuscation, and I am wondering if the outstanding issues can be fixed. [2003-12-25 13:56:59] [EMAIL PROTECTED] Thank you for your bug report. This issue has already been fixed in the latest released version of PHP, which you can download at http://www.php.net/downloads.php Neither Jani (sniper) nor I could replicate the bug on Win32 or Linux. The font checking code works with full paths, font name (without extension) and font name with extension. [2003-12-24 15:59:49] choinet at rocketmail dot com sniper states that the bug has been fixed and such changes should be reflected within the STABLE CVS in due time. However, there must have been a mistake in the determination of the status. If he/she is referring to the initial fix that has been made by iliaa, I am still reporting problems with that, for I am sure that such changes have been reflected in the latest snapshot, and it has been a little over a week now since word of the fix. This seems to be the case, as there, indeed, has been a change in the CVS to accomodate relative pathnames. However, the fix is still incomplete, as one may not directly list the complete relative pathname of the fontfile, only 'filename' (instead of 'filename.ext'). This is a problem if the filename does
#26635 [Opn]: imagettfbbox() & imagettftext() fontfile does not allow relative path
ID: 26635 User updated by: choinet at rocketmail dot com Reported By: choinet at rocketmail dot com Status: Open Bug Type: GD related Operating System: Windows XP PHP Version: 4CVS-2003-12-18 New Comment: Just want to add that I am using the PHP 4.3.5-DEV (Built On: Dec 18, 2003 21:30 GMT), and that the PHP installation is clean (php4ts.dll, php.ini are from the latest CVS). Previous Comments: [2003-12-18 19:55:35] choinet at rocketmail dot com I am now using the latest STABLE CVS, and I still encounter problems with using the full filename 'arial.ttf' in place of 'arial'. I do believe that this is a bug, because PHP 4.3.4 seems to accept either format on a Linux installation. The naming convention issue is still lingering for the STABLE CVS version, although I am not sure whether or not that is a PHP issue or one that is related to the filesystem, for the same problem occurs on Linux when the absolute path has spaces in it. [2003-12-18 17:52:59] [EMAIL PROTECTED] Using latest STABLE CVS (PHP 4.3.5-dev) this works just fine. You should cleanup your machine out of all existing php related files, e.g. php4ts.dll and get the latest snapshot. [2003-12-17 17:56:28] choinet at rocketmail dot com I just checked using PHP5 CVS (Built On: Dec 17, 2003 19:30 GMT), and relative paths ('./arial' and 'arial') do work, but only without the '.ttf' file extension. For example, 'arial.ttf' as the fontfile argument does not work. Absolute paths to the fontfile still do not work, neither in the MS-DOS naming convention ('C:\Progra~1\Apache~1\Apache2\htdocs\arial.ttf') nor in the general way ('C:\Program Files\Apache Group\Apache2\htdocs\arial.ttf'). [2003-12-17 11:16:21] [EMAIL PROTECTED] if arial.ttf is inside C:\Program Files\Apache Group\Apache2\htdocs it will try to open it. [2003-12-16 23:50:39] choinet at rocketmail dot com er wait, I get C:\Program Files\Apache Group\Apache2\htdocs (without the trailing backslash) The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/26635 -- Edit this bug report at http://bugs.php.net/?id=26635&edit=1
#26635 [Opn]: imagettfbbox() & imagettftext() fontfile does not allow relative path
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: er wait, I get C:\Program Files\Apache Group\Apache2\htdocs (without the trailing backslash) Previous Comments: [2003-12-16 23:49:41] choinet at rocketmail dot com I get C:\Program Files\Apache Group\Apache2\htdocs\ [2003-12-16 18:37:27] [EMAIL PROTECTED] if you add echo getcwd(); to your script, what directory does it show? [2003-12-16 16:49:08] choinet at rocketmail dot com After checking, I determined that the problem with opening the fontfile in the PHP 5 CVS version of imagettftext() occurs on both Apache 1 and 2 (both sapi modules). [2003-12-16 16:25:42] [EMAIL PROTECTED] Are you using php as CGI? [2003-12-16 16:17:45] choinet at rocketmail dot com I just downloaded both the PHP 5 CVS (Built On: Dec 16, 2003 19:30 GMT) and the Stable 4.3 (Built On: Dec 16, 2003 17:30 GMT) from snaps.php.net, and neither one seems to have fixed the problem. Now, imagettftext and imagettfbbox don't seem to accept even the absolute pathname to the fontfile. I did use the php4apache2.dll from the beta 2 release of PHP 5 for the CVS version, since the CVS version was missing it. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/26635 -- Edit this bug report at http://bugs.php.net/?id=26635&edit=1
#26635 [Opn]: imagettfbbox() & imagettftext() fontfile does not allow relative path
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] 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