Edit report at https://bugs.php.net/bug.php?id=48555&edit=1
ID: 48555
Comment by: dirk at haun-online dot de
Reported by: a dot schilder at gmx dot net
Summary: ImageFTBBox() differs from previous versions for
texts with new lines
Status: Closed
Type: Bug
Package: GD related
Operating System: Windows XP SP3
PHP Version: 5.3.0RC4
Assigned To: tabe
Block user comment: N
Private report: N
New Comment:
The test for this bug fails when building PHP 5.4.0beta1:
FAILED TEST SUMMARY
---------------------------------------------------------------------
Bug #48555 (ImageFTBBox() differs from previous versions for texts with new
lines) [ext/gd/tests/bug48555.phpt]
Also see:
http://news.php.net/php.qa.reports/30327
http://qa.php.net/reports/viewreports.php?version=5.4.0beta1&test=%2Fext%2Fgd%2Ftests%2Fbug48555.phpt
Previous Comments:
------------------------------------------------------------------------
[2009-06-21 06:13:29] [email protected]
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.
------------------------------------------------------------------------
[2009-06-19 15:20:23] a dot schilder at gmx dot net
This is possibly a side effect of the fix for Bug #43073.
------------------------------------------------------------------------
[2009-06-19 12:08:35] a dot schilder at gmx dot net
Version and OS updated
------------------------------------------------------------------------
[2009-06-19 12:06:32] a dot schilder at gmx dot net
Find examples for the previous script here...
PHP 5.2.9:
https://www.sendthisfile.com/TsuYvRJwezhz3UCRzlHzIQsm
PHP 5.3.0RC4:
https://www.sendthisfile.com/z8UK5VlTqiUUSKMKQ2lgoplp
------------------------------------------------------------------------
[2009-06-19 11:57:45] a dot schilder at gmx dot net
This bug still exists in RC4 and it's critical for me, because with the wrong
value it's no more possible to create valid images (because this is used for
the basline value in ImageFTText()).
Try this to see it:
<?php
$font_file = './arial.ttf';
$text = "Text with\nline-break";
// get minimum size
$box = ImageFTBBox(13, 0, $font_file, $text);
$left = 0;
$top = abs($box[7]);
$width = abs($box[2]) + abs($box[6]);
$height = abs($box[3]) + abs($box[7]);
// add 1px border
$left++;
$top++;
$width+=2;
$height+=2;
// create image and add text
$img = ImageCreateTruecolor($width, $height);
$color = imagecolorallocate($img, 233, 14, 91);
ImageFTText($img, 13, 0, $left, $top, $color, $font_file, $text);
// output
header("Content-Type: image/png");
ImagePng($img);
?>
------------------------------------------------------------------------
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
https://bugs.php.net/bug.php?id=48555
--
Edit this bug report at https://bugs.php.net/bug.php?id=48555&edit=1