note 51494 added to function.imagettftext

From: Date: Fri, 01 Apr 2005 09:18:31 +0000
Subject: note 51494 added to function.imagettftext
Groups: php.notes 
Request: Send a blank email to php-notes+get-87308@lists.php.net to get a copy of this message
A trivial function to get right or centre aligned horizontal text: function imagettftextalign($image, $size, $angle, $x, $y, $color, $font, $text, $alignment='L') { //check width of the text $bbox = imagettfbbox ($size, $angle, $font, $text); $textWidth = $bbox[2] - $bbox[0]; switch ($alignment) { case "R": $x -= $textWidth; break; case "C": $x -= $textWidth / 2; break; } //write text imagettftext ($image, $size, $angle, $x, $y, $color, $font, $text); } ---- Manual Page -- http://www.php.net/manual/en/function.imagettftext.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+51494 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51494&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51494&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51494&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51494&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51494&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+51494&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#87308) next »