Cela dépend exactement comment créer l'avatar dans Flash. Par coïncidence, mon groupe a développé une application de démonstration qui fonctionne comme ça. Il s'appelle FunIcons, vous pouvez sélectionner un personnage puis créer une animation en dessinant un chemin sur le visage avec la souris (appuyez et maintenez le bouton de la souris pour le faire), puis en cliquant sur le bouton "Sauvegarder", vous allez obtenir un gif animé avec la séquence que vous venez de tracer.
L'astuce est simple: un script PHP côté serveur prend la séquence des fichiers GIF qui construisent l'animation, et construit un GIF animé à partir de ceux-ci. Voici le script lui-même:
<?php
header ("Content-type: image/gif");
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache"); // HTTP/1.0
header ("Content-Disposition: attachment; filename=\"funicons.gif\"");
require_once "GifBuilder/GIFEncoder.class.php";
$path = "http://" . $_SERVER["HTTP_HOST"] . $_SERVER["PHP_SELF"];
$i = strrpos($path, "/");
$path = substr($path, 0, $i+1);
$images = split(",", $_REQUEST["images"]);
$prevUrl = "";
while (list ($key, $val) = each($images))
{
if (substr($val, 0, strlen($path)) == $path) $val = substr($val, strlen($path));
if ($val == $prevUrl)
{
$delay[count($delay)-1] += 10;
} else {
$frames[] = file_get_contents($val);
$delay[] = 10;
$prevUrl = $url;
}
@set_time_limit(30);
}
$gif = new GIFEncoder ($frames, $delay, 0, 2, -1, -1, -1, "bin");
print($gif->GetAnimation());
?>
Merci, ça a l'air bien. – andyk