ID: 48555 Updated by: t...@php.net Reported By: a dot schilder at gmx dot net -Status: Open +Status: Closed Bug Type: GD related Operating System: Windows XP SP3 PHP Version: 5.3.0RC4 -Assigned To: +Assigned To: tabe New Comment:
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. Previous Comments: ------------------------------------------------------------------------ [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); ?> ------------------------------------------------------------------------ [2009-06-15 10:05:09] a dot schilder at gmx dot net Description: ------------ The results of ImageFTBBox() differs from previous versions for texts with new lines. The image creation works for PHP 5.04 to 5.2.9 (5.2.10 not tested). but with PHP 5.3RC3 the results are very strange... Reproduce code: --------------- <?php header('Content-Type: text/plain'); $font_file = './arial.ttf'; $box = ImageFTBBox(13, 0, $font_file, "Text without line-break"); echo 'Top without line-break: ' . $box[7] . "\n"; $box = ImageFTBBox(13, 0, $font_file, "Text with\nline-break"); echo 'Top with line-break: ' . $box[7] . "\n"; ?> Expected result: ---------------- Top without line-break: -14 Top with line-break: -14 (result with PHP 5.2.9 and previous versions) Actual result: -------------- Top without line-break: -14 Top with line-break: -36 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48555&edit=1