Edit report at http://bugs.php.net/bug.php?id=24280&edit=1
ID: 24280 Comment by: rasmus at mindplay dot dk Reported by: haafiz at ezwebsolutions dot ca Summary: imagettftext() randomly returns a warning Status: Bogus Type: Bug Package: GD related Operating System: Windows 2000 Server PHP Version: 4.3.2 Block user comment: N Private report: N New Comment: Are you positive that this is not a bug? I ran into it today - with PHP 5.3.1 on localhost. As I am the only user on my own local machine, I don't understand how this could be a thread issue. For reasons I don't understand, it may be a thread issue, I can't say for sure of course. But if you're using a non-thread-safe library in an application or library that is designed to be thread-safe, wouldn't it make sense to surround those calls with some form of mutex/lock/unlock statements? I realize that would degrade performance on multi-threaded servers - but if you're going to use these functions at all, degraded performance is probably preferable to dead applications. Or not? Previous Comments: ------------------------------------------------------------------------ [2003-06-23 17:40:43] il...@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Unfortunately Freetype functions are not thread safe, so in a threaded enviroment problems such as the ones you are experiencing will occur. ------------------------------------------------------------------------ [2003-06-23 14:44:35] haafiz at ezwebsolutions dot ca Also, in addition to the "Problem loading glyph in..." problems, I get some "Problem setting text size" errors as well. And, this problem goes away every time you restart apache, but that means I have to keep restarting it to make it work. If I put an "@" in front of the errornous lines, it doesnt give me a Red X but just the image without the text on it. ------------------------------------------------------------------------ [2003-06-21 16:18:30] haafiz at ezwebsolutions dot ca Description: ------------ Every so often, I get this output from my file: <br /> <b>Warning</b>: imagettftext(): Problem loading glyph in <b>g:\hostroot\a0007\default\wwwroot\images\button.php</b> on line <b>81</b><br /> PNG IHDR §~ TPLTE êêÕêêÔßß¿ÞÞ½ÏÏááÂdÏÏççÎÙÙ³ØØ±ÓÓ§__G¨¨~mÐÐ °°GG5vvYÌ̲² 33&ffLLL9_rµg" ÅIDATxíÉà D§û¾ øÿÿ³6iZåDÄ¡sãx²³ù®&WX,÷5i»ÁáH5é|ú©^"$õ:VÞ#>ê¢D¾WÈX°£À°¦YÔsyFj*O·æ BÁuf ²HMå´àã줻5ä¯"&"òNL¼àío¢Æ4 QÜWÜ |»55'Ê9Jælßɦ&ÐJ¤¦âDõèO4®*®·KMzÜÆáÁ:¨O 6 IEND®B` And so ofcourse, the image displays as the notorious red X in IE Reproduce code: --------------- <?php define("FONTFILE", "./arial.ttf"); define("FONTSIZE", 8); define("WIDTH", 145); if ($_GET["bottom"] == 1) { define("HEIGHT", 20); $mod = -1; } else { define("HEIGHT", 19); $mod = 0; } $im = imagecreate(WIDTH,HEIGHT); $black = imagecolorallocate($im, 0, 0, 0); //This part of the code was omited because of its length. It basically is a bunch of imagesetpixel(), imageline(), and imagefilledrectangle() functions to give this button a 3d bevel. //text $textdata = imagettfbbox(FONTSIZE, 0, FONTFILE, $_GET["text"]); $bbox_h = $textdata[1] - $textdata[7]; imagettftext($im, FONTSIZE, 0, 4, 14, $black, FONTFILE, $_GET["text"]); imagepng($im); ?> Expected result: ---------------- Most of the time this works, but it randomly gives the error described above. This problem only occurs on PHP 4.3.2 and worked fine under 4.2.3. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=24280&edit=1