note 80186 added to function.imagestring
| From: | Epidemiah at osu1 dot php dot net | Date: | Thu, 03 Jan 2008 13:06:11 +0000 |
| Subject: | note 80186 added to function.imagestring | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-134712@lists.php.net to get a copy of this message | ||
Its just an easy function to write an string in the middle of a picture.
<?php
function imageCenterString(&$img, $font, $text, $color)
{
if($font < 0 || $font > 5){ $font = 0; }
$num = array(array(4.6, 6),
array(4.6, 6),
array(5.6, 12),
array(6.5, 12),
array(7.6, 16),
array(8.5, 16));
$width = ceil(strlen($text) * $num[$font][0]);
$x = imagesx($img) - $width - 8;
$y = Imagesy($img) - ($num[$font][1] + 2);
imagestring($img, $font, $x/2, $y/2, $text, $color);
}
?>
----
Server IP: 212.124.37.9
Probable Submitter: 79.221.214.119
----
Manual Page -- http://www.php.net/manual/en/function.imagestring.php
Edit -- https://master.php.net/note/edit/80186
Del: integrated -- https://master.php.net/note/delete/80186/integrated
Del: useless -- https://master.php.net/note/delete/80186/useless
Del: bad code -- https://master.php.net/note/delete/80186/bad+code
Del: spam -- https://master.php.net/note/delete/80186/spam
Del: non-english -- https://master.php.net/note/delete/80186/non-english
Del: in docs -- https://master.php.net/note/delete/80186/in+docs
Del: other reasons-- https://master.php.net/note/delete/80186
Reject -- https://master.php.net/note/reject/80186
Search -- https://master.php.net/manage/user-notes.php