bruce678 |
08-23-2010 01:39 AM |
RE: How to change the font of siggy.php ?
Quote:
Originally Posted by fadillzzz
No, you don't need the imageloadfont to use imagettftext
read this
http://php.net/manual/en/function.imagettftext.php
and compare it to
http://php.net/manual/en/function.imagestring.php
imageloadfont is needed only if you want to use imagestring with custom font
take a look at my code
PHP Code:
$str1 = "".$name;
$str2 = "Level:".$level;
$str3 = "".$domain;
$font = 'path/to/your/font.ttf';
$black = imagecolorallocate($image, 20, 20, 20);
imagettftext ($image, 16, 0, 0, $textheight + 18, $black, $font, $str1);
imagettftext ($image, 16, 0, 0, $textheight + 34, $black, $font, $str2);
imagettftext ($image, 16, 0, 0, $textheight + 50, $black, $font, $str3);
you can leave the '$image' untouch, and the number '16' is the font size, the first '0' is the angle, the second '0' is the x coordinates, the '$textheight ...' is the y coordinate, '$black' represent the font color, and '$font' is the font itself and last but not least '$str*' is the text to be loaded
Don't forget to define the variable like '$black' and '$font' before the imagettftext
Also, if you are still wondering how to center the text (using imagestring), read this
http://www.php.net/manual/en/function.imagestring.php#94306
|
|