note 18600 added to function.imagettfbbox

From: Date: Tue, 29 Jan 2002 04:42:27 +0000
Subject: note 18600 added to function.imagettfbbox
Groups: php.notes 
Request: Send a blank email to php-notes+get-25955@lists.php.net to get a copy of this message
I have the alignment code done: $align can be 'center', 'left', or 'right'. $valign can be 'center', 'top', or 'bottom'. It sets $x and $y which can be used in ImageTTFText() to place the text with the alignment specified. $box = ImageTTFBBox($font_size, 0, $font, $text); if ($align == 'left') { $x = min($box[0], $box[6]); } elseif ($align == 'center') { $x_left = min($box[0], $box[6]); $x_right = max($box[2], $box[4]); $x_width = $x_right - $x_left; $x = ceil(($width - $x_width) / 2); } elseif ($align == 'right') { $x_left = min($box[0], $box[6]); $x_right = max($box[2], $box[4]); $x_width = $x_right - $x_left; $x = ceil($width - $x_right); } if ($valign == 'top') { $y_top = max($box[5], $box[7]); $y_bottom = min($box[3], $box[1]); $y_height = $y_bottom - $y_top; $y = 0 + $y_height; } elseif ($valign == 'center') { $y_top = max($box[5], $box[7]); $y_bottom = min($box[3], $box[1]); $y_height = $y_top - $y_bottom; $y = floor(($height - $y_height) / 2); } elseif ($valign == 'bottom') { $y = $height; } -- http://www.php.net/manual/en/function.imagettfbbox.php http://master.php.net/manage/user-notes.php?action=edit+18600 http://master.php.net/manage/user-notes.php?action=delete+18600 http://master.php.net/manage/user-notes.php?action=reject+18600

« previous php.notes (#25955) next »