$height) && ($x > $height)) { break; } } #-- more disturbing II, random letters $limit = rand(30,90); for ($n=0; $n<$limit; $n++) { $letter = ""; do { $letter .= chr(rand(31,125)); // random symbol } while (rand(0,1)); $size = rand(5, $height/2); $half = (int) ($size / 2); $x = rand(-$half, $width+$half); $y = rand(+$half, $height); $rotation = rand(60, 300); $c1 = random_color($Image, 130^$R, 240^$R); //$font = $fonts[rand(0, count($fonts)-1)]; imagettftext($Image, $size, $rotation, $x, $y, $c1, $font, $letter); } #-- add the real text to it $len = strlen($phrase); $w1 = 10; $w2 = $width / ($len+1.5); for ($p=0; $p<$len; $p++) { $letter = $phrase[$p]; $size = rand(18, $height/2.2); $half = (int) $size / 2; $rotation = rand(-33, 33); $y = rand($size+3, $height-3); $x = $w1 + $w2*$p; $w1 += rand(-$width/90, $width/40); // @BUG: last char could be +30 pixel outside of image //$font = $fonts[rand(0, count($fonts)-1)]; $r=rand(30,99); $g=rand(30,99); $b=rand(30,99); // two colors for shadow $c1 = imagecolorallocate($Image, $r*1^$R, $g*1^$R, $b*1^$R); $c2 = imagecolorallocate($Image, $r*2^$R, $g*2^$R, $b*2^$R); $c3 = imagecolorallocate($Image, 150, 120, 90); //imagestring ($Image, round(rand(3,10)), $x, $y-20, $letter, $c3); imagettftext($Image, $size, $rotation, $x+1, $y, $c2, $font, $letter); imagettftext($Image, $size, $rotation, $x, $y-1, $c1, $font, $letter); } header ("Content-type: image/jpeg"); /* si votre serveur ne manage pas les police ttf alors decommenter le code ce dessous */ /* imagedestroy($Image); $Image = @imagecreate (60, 20) or die ("Impossible d'initialiser la bibliothèque GD"); $CouleurFond = imagecolorallocate ($Image, 200, 200, 200); $CouleurTexte = imagecolorallocate ($Image, 120, 120, 120); imagestring ($Image, 3, 3, 3, $phrase, $CouleurTexte); */ imagejpeg ($Image,"",90); imagedestroy($Image); function random_color($Image, $a,$b) { return imagecolorallocate($Image, rand($a,$b), rand($a,$b), rand($a,$b)); } ?>