View Single Post
  #10  
Old 08-21-2010, 05:01 AM
fadillzzz fadillzzz is offline
Dev Staff
 
Join Date: Jan 2010
Posts: 501
Gender: Male
Credits: 32,988
fadillzzz is an unknown quantity at this point
Default RE: How to change the font of siggy.php ?

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($image202020); 

    
imagettftext ($image1600$textheight 18$black$font$str1);
    
imagettftext ($image1600$textheight 34$black$font$str2);
    
imagettftext ($image1600$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
Reply With Quote