#26635 [Fbk-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: Feedback +Status: Open Bug Type: *Graphics related Operating System: Windows XP PHP Version: 4.3.4 New Comment: 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'). Previous Comments: [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) [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). 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=26635edit=1
#26635 [Fbk-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: Feedback +Status: Open Bug Type: *Graphics related Operating System: Windows XP PHP Version: 4.3.4 New Comment: 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). Previous Comments: [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. [2003-12-15 15:31:27] [EMAIL PROTECTED] This bug has been fixed in CVS. In case this was a PHP problem, snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites in short time. Thank you for the report, and for helping us make PHP better. [2003-12-15 14:56:55] choinet at rocketmail dot com 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. [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=26635edit=1
#26635 [Fbk-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: Feedback +Status: Open Bug Type: *Graphics related Operating System: Windows XP PHP Version: 4.3.4 New Comment: I get C:\Program Files\Apache Group\Apache2\htdocs\ Previous Comments: [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. [2003-12-15 15:31:27] [EMAIL PROTECTED] This bug has been fixed in CVS. In case this was a PHP problem, snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites in short time. Thank you for the report, and for helping us make PHP better. 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=26635edit=1