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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
| <?
$id=1;
$yeux = $_POST['yeux'];
if(isset($yeux) AND $yeux!=""){
$yeux = "yeux".$yeux.".png";
//header ("Content-type: image/png"); // Afficher l'image | A virer pour l'export
// On charge d'abord les images
$_copyright = imagecreatefrompng("copyright.png"); // Copyright
$_yeux = imagecreatefrompng($yeux); // Yeux
$_visage = imagecreatefrompng("visage1.png"); // Visage
$_fond = imagecreatefromjpeg("fond.jpg"); // Fond
// On met le logo (yeux) dans l'image de visage (la photo)
imagecopymerge($_fond, $_visage, 0, 0, 0, 0, 120, 120, 100);
imagecopymerge($_fond, $_yeux, 0, 0, 0, 0, 120, 120, 100);
imagecopymerge($_fond, $_copyright, 0, 0, 0, 0, 120, 120, 100);
imagepng($_fond, $id.".png"); // imagepng($_fond, "1.png"); ----- Sans le second param, on affiche l'image | Avec on la crée sur le serveur
//imagedestroy($_fond); // On détruit l'image... On libère de la mémoire ?
}
?>
<html>
<head>
<title>Créer son avatar</title>
<script type="text/javascript">
d = document;
function Show(quoi,qui){
d.getElementById(quoi).src=quoi+qui+'.png';
}
</script>
<style type="text/css">
body{margin:50px 0 0 50px;}
img{border:0px;}
.tablo{width:400px; border:1px solid #BBBBBB; background-color:#D4D4D4;}
.tablo td{font-family:Trebuchet MS; font-size:12px; color:#5F5F5F;}
</style>
</head>
<body>
<table border="0" cellpadding="4" cellspacing="1" class="tablo">
<tr>
<td><img src="<? echo $id.".png";?>.png"></td>
<td><b>VOTRE AVATAR ACTUEL</b></td>
</tr>
<tr>
<td valign="top">
<div style="width:120px; height:120px; overflow:none; border:1px solid #AAAAAA;">
<div style="position:relative; top:0px; left:0px; z-index:15;"><img src="copyright.png" id="copyright"></div>
<div style="position:relative; top:-120px; left:0px; z-index:10;"><img src="yeux1.png" id="yeux"></div>
<div style="position:relative; top:-240px; left:0px; z-index:5;"><img src="visage1.png" id="visage"></div>
<div style="position:relative; top:-360px; left:0px; z-index:0;"><img src="fond.jpg" id="fond"></div>
</div>
</td>
<td valign="top">
<form method="post" action="">
<b>CREER UN AVATAR</b><br>
<br>
<label for="yeux1"><input type="radio" id="yeux1" name="yeux" value="1" OnClick="Show('yeux',1);" checked> Yeux1</label><br>
<label for="yeux2"><input type="radio" id="yeux2" name="yeux" value="2" OnClick="Show('yeux',2);"> Yeux2</label><br>
<br>
<label for="visage"><input type="radio" id="visage1" name="visage" value="1" checked> Visage1</label><br>
<br>
<input type="submit" value="Créer">
</form>
</td>
</tr>
</table>
</body>
</html> |