note 101128 added to function.imagettftext
| From: | contact at pointhunter dot net | Date: | Sun, 28 Nov 2010 18:35:41 +0000 |
| Subject: | note 101128 added to function.imagettftext | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-174416@lists.php.net to get a copy of this message | ||
Print username on the picture from a sent variable. (u)
<?php
$USERNAME=$_REQUEST['u'];
// Set the content-type
header('Content-type: image/png');
// Create the image
$im = imagecreatetruecolor(350, 30);
// Create some colors
$white = imagecolorallocate($im, 0, 0, 0);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 255, 255, 255);
imagefilledrectangle($im, 0, 0, 399, 29, $white);
// The text to draw
$text = 'Welcome, '.$USERNAME;
// Replace path by your own font path
$font = 'cour.ttf';
// Add some shadow to the text
imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);
// Add the text
imagettftext($im, 20, 0, 10, 20, $black, $font, $text);
// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?>
----
Server IP: 69.147.83.197
Probable Submitter: 81.22.185.34
----
Manual Page -- http://www.php.net/manual/en/function.imagettftext.php
Edit -- https://master.php.net/note/edit/101128
Del: integrated -- https://master.php.net/note/delete/101128/integrated
Del: useless -- https://master.php.net/note/delete/101128/useless
Del: bad code -- https://master.php.net/note/delete/101128/bad+code
Del: spam -- https://master.php.net/note/delete/101128/spam
Del: non-english -- https://master.php.net/note/delete/101128/non-english
Del: in docs -- https://master.php.net/note/delete/101128/in+docs
Del: other reasons-- https://master.php.net/note/delete/101128
Reject -- https://master.php.net/note/reject/101128
Search -- https://master.php.net/manage/user-notes.php