note 18600 deleted from function.imagettfbbox by sniper

From: Date: Fri, 07 Nov 2003 12:40:30 +0000
Subject: note 18600 deleted from function.imagettfbbox by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-60077@lists.php.net to get a copy of this message
Note Submitter: andy@goder.com ---- 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; }

« previous php.notes (#60077) next »