note 41420 added to function.imagettftext

From: Date: Fri, 09 Apr 2004 05:05:19 +0000
Subject: note 41420 added to function.imagettftext
Groups: php.notes 
Request: Send a blank email to php-notes+get-67862@lists.php.net to get a copy of this message
I frequently found chopped text in my images when calculating the width with imagettfbbox (and it wasn't just because of j's and p's and other "out of bounds" characters), I also found the same thing happening on a number of sites demoing their GD capabilities. What you want to do is the following (assuming width and height are the values you have gleaned from the imagettfbbox function): $width = $width + floor($width / 80); $height = $height + floor($height / 15); I have no idea why 80 and 15 turned out to be the magic ratios, but it's worked like a charm since I've done that. ---- Manual Page -- http://www.php.net/manual/en/function.imagettftext.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+41420 Delete -- http://master.php.net/manage/user-notes.php?action=delete+41420&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+41420&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#67862) next »