|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[1999-08-10 03:05 UTC] markonen at cvs dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 10 03:00:01 2026 UTC |
ImageTTFBBox doesn't return a correct bounding box. In many cases, an image created to be the size of a bounding box will not be tall enough and cuts off part of the text it is meant to contain (in most cases, the bottoms of g's, p's, and other characters with drop-down loopy things). In some occasions, the width of a bounding box will also be inadequate. The following function illustrates: function GIFheadline ($font, $fontsize, $bulletgif, $text, $number) { $bounds = ImageTTFBBox($fontsize, 0, $font, $text); $imagewidth = abs($bounds[2] - $bounds[0]); $imageheight = abs($bounds[1] - $bounds[7]); $image = imagecreate($imagewidth, $imageheight); $textcolor = ImageColorAllocate($image, 98,128,190); imagettftext($image, $fontsize, 0, 0, $imageheight, $textcolor, $font, $text); imagegif($image, "$number.gif"); }