note 32080 deleted from function.imagestring by aidan
| From: | aidan@php.net | Date: | Thu, 26 Aug 2004 06:26:58 +0000 |
| Subject: | note 32080 deleted from function.imagestring by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-75283@lists.php.net to get a copy of this message | ||
Note Submitter: moander at atc dot no
----
// 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);
}