GIF animé avec les class.php
Bonjour.
J'aimerais créer des GIF animés sur mon site avec PHP.
J'ai trouvé des scripts, mais il y a toujours un message d'erreur.
J'utilise GIFEncoder.class.php.
D'abord le script:
Code:
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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
<?php
include "libs/GIFEncoder.class.php";
$string = "Bonjour";
$txt = ' ';
$imgs = array();
$t = array();
foreach(str_split(' '.$string) as $c)
{
$txt .= $c;
//~ Taille de l'image
$im = @imagecreatetruecolor(50 , 50);
//~ Couleur du background
$bg = imagecolorallocate($im, 230,126,48);
//~ Coloration du fond de l'image
imagefill($im, 0, 0, $bg);
//~ Couleur du text
$textcolor = imagecolorallocate($im, 0, 0, 255);
//~ On écrit la chaine
imagestring($im, 5, 0, 0, $txt, $textcolor);
ob_start();
imagegif($im);
$imgs[] = ob_get_clean();
$t[] = 11;
imagedestroy($im);
}
/*
new GIFEncoder
(
URL or Binary data 'Sources'
int 'temps d'affichage' (ne fonctionne pas vraiment)
int 'Nombre d'animation' (0 = infini)
int 'Disposal' (???)
int 'Transparence rouge, vert, bleu'
int 'Type de source'
);
*/
$gif = new GIFEncoder ($imgs, $t, 0, 2, 0, 0, 0, 'bin');
header('Content-type:image/gif');
echo $gif->GetAnimation();
?> |
Le message d'erreur:
<b>Notice</b>: Use of undefined constant ERR00 - assumed 'ERR00' in <b>C:\Users\Glad\Documents\Dossier Projet\Essais\essai_gif_anime.php</b> on line <b>47</b><br />
<br />
<b>Notice</b>: Use of undefined constant ERR01 - assumed 'ERR01' in <b>C:\Users\Glad\Documents\Dossier Projet\Essais\essai_gif_anime.php</b> on line <b>47</b><br />
<br />
<b>Notice</b>: Use of undefined constant ERR02 - assumed 'ERR02' in <b>C:\Users\Glad\Documents\Dossier Projet\Essais\essai_gif_anime.php</b> on line <b>47</b><br />
<br />
<b>Notice</b>: Use of undefined constant ERR03 - assumed 'ERR03' in <b>C:\Users\Glad\Documents\Dossier Projet\Essais\essai_gif_anime.php</b> on line <b>47</b><br />
Je précise que la librairie GD est bien active.
Merci pour votre aide.
Cordialement.