1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
<?php
// Denition du content-type
header("Content-type: image/png");
// Creation de l'image
$im = imagecreate(240, 15);
// Creation de quelques couleurs
$beige = imagecolorallocate($im, 247, 244, 233);
$marron = imagecolorallocate($im, 54, 41, 16);
//Fond transparent
imageColorTransparent($im, $beige);
// Le texte dessiner
function remplace($str)
{
return strtr($str, array('\''=>'’','&'=>'&','<'=>'<','>'=>'>','\"'=>'"','\\'=>' '));
}
$text = remplace($_GET['titre']);
// Remplacez le chemin par votre propre chemin de police
$font = 'London.ttf';
// Ajout du texte
imagettftext($im, 14, 0, 0, 15, $marron, $font, $text);
// Utiliser imagepng() donnera un texte plus claire,
// comparer à l'utilisation de la fonction imagejpeg()
imagepng($im);
imagedestroy($im);
?> |
Partager