3

strlogo

strlogo
SYNOPSIS

strlogo($name)

DESCRIPTION

The character font used to write the text is in the file font.ttf at the root of the site.

CODE
  1. function strlogo($name) {
  2.     $waspfile=ROOT_DIR . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'wasp.png';
  3.     $fontfile=ROOT_DIR . DIRECTORY_SEPARATOR . 'font.ttf';
  4.     $fontsize=24.0;
  5.  
  6.     $bbox = imageftbbox($fontsize, 0, $fontfile, $name);
  7.  
  8.     $w=$bbox[2]+48+5;
  9.     $h=40;
  10.  
  11.     $wasp = @imagecreatefrompng($waspfile) or die();
  12.     $img = @imagecreatetruecolor($w, $h) or die();
  13.  
  14.     $bg=imagecolorallocate($img, 255, 255, 255);
  15.     $fg=imagecolorallocate($img, 0x33, 0x33, 0x33);
  16.  
  17.     imagecolortransparent($img, $bg);
  18.     imagefill($img, 0, 0, $bg);
  19.  
  20.     imagettftext($img, $fontsize, 0, 0, 30, $fg, $fontfile, $name);
  21.  
  22.     imagecopy($img, $wasp, $w-48, 0, 0, 0, 48, 48);
  23.  
  24.     return $img;
  25. }

Comments

Your comment:
[p] [b] [i] [u] [s] [quote] [pre] [br] [code] [url] [email] strip help 2000

===

Enter a maximum of 2000 characters.
Improve the presentation of your text with the following formatting tags:
[p]paragraph[/p], [b]bold[/b], [i]italics[/i], [u]underline[/u], [s]strike[/s], [quote]citation[/quote], [pre]as is[/pre], [br]line break,
[url]http://www.izend.org[/url], [url=http://www.izend.org]site[/url], [email]izend@izend.org[/email], [email=izend@izend.org]izend[/email],
[code]command[/code], [code=language]source code in c, java, php, html, javascript, xml, css, sql, bash, dos, make, etc.[/code].