11

strtag

strtag
SYNOPSIS

strtag($text)

DESCRIPTION
CODE
  1. function strtag($text) {
  2.     $len=strlen($text);
  3.  
  4.     $fontfile=ROOT_DIR  . DIRECTORY_SEPARATOR . 'font.ttf';
  5.     $fontsize=24.0;
  6.  
  7.     $bbox = imageftbbox($fontsize, 0, $fontfile, $text);
  8.  
  9.     $w=$bbox[2]+$len*15;
  10.     $h=40;
  11.  
  12.     $img = @imagecreatetruecolor($w, $h) or die();
  13.  
  14.     $bg=imagecolorallocate($img, 255, 255, 224);
  15.     $fg=imagecolorallocate($img, 64, 64, 64);
  16.  
  17.     imagefill($img, 0, 0, $bg);
  18.  
  19.     // print text unevenly
  20.     for ($x=15, $i=0; $i<$len; $i++) {
  21.         $y = rand($h/2,$h/2+15);
  22.         $r = rand(-45, 45);
  23.         imagettftext($img, $fontsize, $r, $x, $y, $fg, $fontfile, $text[$i]);
  24.         $x += rand(25, 35);
  25.     }
  26.  
  27.     // blur with colored dots
  28.     for ($i=0; $i<$w*$h/2.0; $i++) {
  29.         $color=imagecolorallocate($img, rand(128,255), rand(128,255), rand(128,255));
  30.         imagesetpixel($img, rand(0,$w-1), rand(0,$h-1), $color);
  31.     }
  32.  
  33.     return $img;
  34. }
VOIR AUSSI

emailcrypto

Commentaires

Votre commentaire :
[p] [b] [i] [u] [s] [quote] [pre] [br] [code] [url] [email] strip aide 2000

Entrez un maximum de 2000 caractères.
Améliorez la présentation de votre texte avec les balises de formatage suivantes :
[p]paragraphe[/p], [b]gras[/b], [i]italique[/i], [u]souligné[/u], [s]barré[/s], [quote]citation[/quote], [pre]tel quel[/pre], [br]à la ligne,
[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]commande[/code], [code=langage]code source en c, java, php, html, javascript, xml, css, sql, bash, dos, make, etc.[/code].