ID:               33692
 Updated by:       [EMAIL PROTECTED]
 Reported By:      a dot vent at procommerz dot de
-Status:           Open
+Status:           Feedback
 Bug Type:         GD related
 Operating System: Debian Linux 3.0 "Woody"
 PHP Version:      4.4.0
 New Comment:

Why don't you try with Freetype 2? That might actually work..


Previous Comments:
------------------------------------------------------------------------

[2005-07-15 11:59:33] a dot vent at procommerz dot de

Additional note: 
 
After further dealing with this issue I found that 
imagettftext works fine on 8 bit images (when using 
"imagecreate" instead of "imagecreatetruecolor"), but not 
on true color images. 
 
There is a workaround proposal published by 
"persa"
(http://www.webdeveloper.com/forum/showthread.php?threadid=30767) 
that is to create two images (one of them at 8 bit) and 
then merging them together after putting the text onto the 
8 bit image. 
 
It actually seems to be a bug, doesn't it? 
 
Best regards, 
Andreas

------------------------------------------------------------------------

[2005-07-14 09:50:28] a dot vent at procommerz dot de

Description:
------------
The ImageTTFText function produces no result, but also no  
error. I've tried several font files (Microsoft TT core 
fonts and also from other sources), several paths (the  
same dir as the PHP script, relative to DocRoot, absolute 
path a.s.o.).  
  
It looks like not calling imagettftext - the function  
silently does nothing...  
  
I have Debian "Woody" with Apache 1.3.29 / PHP 4.4.0. The  
GD lib is the bundled one (phpinfo says: "2.0.28  
compatible"). The Freetype lib version is 1.4pre, as  
provided from Debian package manager. 
 
PHP configure options: 
 
'./configure' '--with-apxs=/var/www/bin/apxs' 
'--with-mysql' '--enable-ftp' '--enable-shared' 
'--with-iconv' '--with-gd' '--with-curl' 
'--with-jpeg-dir=/usr' '--with-png-dir=/usr' 
'--with-dom=/usr' '--with-zlib' '--enable-cli'  
'--with-ttf=/usr' 
 
Output snippet from phpinfo: 
 
GD Support  
enabled  
 
GD Version  
bundled (2.0.28 compatible)  
 
FreeType Support  
enabled  
 
FreeType Linkage  
with TTF library  
 
GIF Read Support  
enabled  
 
GIF Create Support  
enabled  
 
JPG Support  
enabled  
 
PNG Support  
enabled  
 
WBMP Support  
enabled  
 
XBM Support  
enabled 

Reproduce code:
---------------
<?php
header("Content-type: image/png");
$im = imagecreatetruecolor(400, 30);
$grey = imagecolorallocate($im, 102, 102, 102);
$white = imagecolorallocate($im, 255, 255, 255);
$red = imagecolorallocate($im, 255, 0, 0);

imagefill($im, 0, 0, $grey);

$fontfile = realpath("./Arial.ttf");

imagettftext($im, 20, 0, 10, 20, $white, $fontfile, "Hello World!");

imagepng($im);
imagedestroy($im);
?>

Expected result:
----------------
Displays an image with white-colored text "Hello World" in 
Arial font face on grey background.  

Actual result:
--------------
Displays an grey-colored image without any text (empty  
grey box). No error messages. 


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=33692&edit=1

Reply via email to