php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30739 Writing on a Black BG
Submitted: 2004-11-10 00:05 UTC Modified: 2004-11-17 18:18 UTC
From: nate at highsocietyfreeride dot com Assigned: pajoye (profile)
Status: Closed Package: GD related
PHP Version: 4.3.10-dev OS: apache?
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
20 + 35 = ?
Subscribe to this entry?

 
 [2004-11-10 00:05 UTC] nate at highsocietyfreeride dot com
Description:
------------
First off, I'm not sure what verison of PHP our servers use.  My hosting service is IpowerWeb.com

When I use imagettftext to write onto an image, it works fine, unless I allocate the color of 0,0,0.  Even 1,1,1 works just fine.

When I write to a complete black background the text shows up as rectangles, not the actual letters.  The rectangles look like bounding boxes because they take the size of the actual letter its trying to print.

Reproduce code:
---------------
<?php
	$im_header = imagecreatetruecolor( 440, 83);
	$white = imagecolorallocate($im_header, 255, 255, 255);
	$black = imagecolorallocate($im_header, 0, 0, 0);
	imagefill($im_header,0,0,$black);
	imagecolortransparent($im_header, $black);
	
	imagettftext($im_header, 32, 0, 0, 42, $white, "fonts/verdana.TTF", "test");
	
	imagejpeg($im_header);
?>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-10 09:39 UTC] tony2001@php.net
Confirmed with 4.3.10-dev, not reproducible with 5.0.x & 5.1.x branch.
 [2004-11-17 18:18 UTC] pajoye@php.net
This bug has been fixed in CVS.

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/.
 
Thank you for the report, and for helping us make PHP better.

Hello,

The bug was due to imagefill, it did not set back the alphablending to true. This is somehow required for font rendering with antialiasing.

Btw, with true color images you do not need to fill the background with black, the default is black (0).

a temporary fix is to call imagealphablending(true); after imagefill.

Bug is fixed in cvs.

Thanks for this report,

--Pierre
 [2013-08-28 08:37 UTC] daverandom@php.net
Automatic comment from SVN on behalf of daverandom
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=331209
Log: This is due to the removal of Logo GUIDs, instead a new substitute (data URIs and direct embedding of the credits) is used, which means that expose_php has no effect.

--
Provided by anonymous #30739 (ajf@ajf.me)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 18:01:29 2024 UTC