note 32080 added to function.imagestring
| From: | moander at atc dot no | Date: | Thu, 15 May 2003 17:32:04 +0000 |
| Subject: | note 32080 added to function.imagestring | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-48030@lists.php.net to get a copy of this message | ||
// Align string on image
// $x and $y values
// 0 align left or top
// 1 align center
// 2 align right or bottom
function ImageStringAlign(&$image, $font, $x, $y, $s, $col) {
switch ($x) {
case 0: $x = 2; break;
case 1: $x = floor((ImageSX($image) / 2) - ((ImageFontWidth($font) * strlen($s)) / 2)); break;
case 2: $x = (ImageSX($image) - (ImageFontWidth($font) * strlen($s))) - 2; break;
}
switch ($y) {
case 0: $y = 2; break;
case 1: $y = floor((ImageSY($image) / 2) - (ImageFontHeight($font) / 2)); break;
case 2: $y = (ImageSY($image) - ImageFontHeight($font)) - 2; break;
}
ImageString($image, $font, $x, $y, $s, $col);
}
--
http://www.php.net/manual/en/function.imagestring.php
http://master.php.net/manage/user-notes.php?action=edit+32080
http://master.php.net/manage/user-notes.php?action=delete+32080
http://master.php.net/manage/user-notes.php?action=reject+32080