php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17924 String is missing when using functions like imageTTFtext
Submitted: 2002-06-22 12:41 UTC Modified: 2002-06-22 12:45 UTC
From: mathias dot grub at web dot de Assigned:
Status: Closed Package: GD related
PHP Version: 4.2.1 OS: Windows 2000 pro
Private report: No CVE-ID: None
 [2002-06-22 12:41 UTC] mathias dot grub at web dot de
When running PHP with GD > 2 and Freetype >= 2 all functions which use ttf fonts (different from the built-in fonts (1-5)) don't draw the requested text string on the image, eg:

imageLoadFont($pathtofont)or die('damn, cannot loadit');

results always in the 'or die()' part. In any case. Independent on if you use doc-relative path, root-relative path or absolute path (including drive letter/ IP).

The windows binary of PHP 4.06 comes with GD 1.64. And phpinfo() says for 'FreeType Linkage' TrueType Library. If this is so, the above and following problems don't appear and solved. But the PHP 4.10, 4.11, 4.12 Windows Distributions come with GD 2.0 or higher and obviously with freetype V.1, because the function imageFTtext() creates an error: Freetype 2 is required.
OK, lets install PHP 4.21 to get Freetype 2 support. Well done, the error message when using imageTTFtext() or imageFTtext is gone, but the wanted string is left blank.
Beside to the function above imageloadfont()or die(); which always ends in the or die part. I guess the trio PHP 4.2/GD2/Freetype2 is not able to write text with ttf fonts onto an image. Seems to be an (evil, bad) bug.
Am I right?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-22 12:45 UTC] mfischer@php.net
Please try the recent snapshot from http://snaps.php.net/win32/php4-win32-latest.zip , I bet this is fixed. Reopen if it's not.
 [2002-06-24 03:54 UTC] mathias dot grub at web dot de
OK, it seems to be a bug, unsolved until today. One possibility to handle it, is to run 2 php Versions
(This config tipp runs with Win/Apache and PHP >4.2 configuered as the cgi AND not the module Version!):
Copy your php directory (in most cases the cgi-bin in the Apache dir) to a new dir called php4 in the Apache dir.
OK, the php.ini File MUST NOT be in in the Windoews directory, it has to be placed into the same dir of yyour php.exe, because we need two different php.ini files.

Go on, edit the http.conf of the Apache like this:
Below an existing line like similar to this
ScriptAlias /cgi-bin/ "C:/Apache/cgi-bin/"
add the line
ScriptAlias /php4/ "C:/Apache/php4/"
(the path to the second php installation)
Then check all lines starting with 
AddType application/x-httpd-php
if there is any .php4 extension to be found, delete it and add the line
AddType application/x-httpd-php4 .php4
ATTENTION! If you're used to use .php4 files don't delete the above extension, but use another new application type, such as x-http-phpx .phpx
Last line to add is below:
Action application/x-httpd-php "/cgi-bin/php.exe"
add:
Action application/x-httpd-php4 "/php4/php.exe"
Attention, the path listed has to be the same as the one of the Script-Alias.
Now edit both php.ini files. The difference is set to the extensions. Wether the .php files has to use the php_gd2.dll, the php4 files should use the php_gd.dll!!!
All done.
The last thing is that you cannot use both in one file, the new and better gd2 functions like imagecopyresampled() and the text functions like imageTTFtext() until this bug is solved.
But you can - with a little bit more amount of coding and files - use the best of all.

Greetings,
Mathias
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 13:01:28 2024 UTC