<?php header('Content-Type: image/png'); $imagename = "avatar_cyol.png"; //Générer l'image $image = @imagecreatefrompng($imagename); //Ici on mettra le reste du code qu'on va voir ensuite //Crayons de couleur $noir = imagecolorallocate($image, 0, 0, 0); $blanc = imagecolorallocate($image, 255, 255, 255); $rouge = imagecolorallocate($image, 255, 0, 0); $vert = imagecolorallocate($image, 0, 255, 0); $bleu = imagecolorallocate($image, 0, 0, 255); //Texte P2 imagestring($image, 2, 60, 75, "P2:", $noir); imagestring($image, 2, 59, 74, "P2:", $blanc); $p2 = 6; imagestring($image, 3, 80, 75, $p2, $noir); imagestring($image, 3, 79, 74, $p2, $vert); //Barres de progressions $x1 = 5; $x2 = 25 + $x1; $y1 = 4; $y2 = 6; $y3 = 9; $y4 = 11; $y5 = 14; $y6 = 16; imagefilledrectangle($image, $x1+1, $y1+1, $x2+1, $y2+1, $noir); imagefilledrectangle($image, $x1+1, $y3+1, $x2+1, $y4+1, $noir); imagefilledrectangle($image, $x1+1, $y5+1, $x2+1, $y6+1, $noir); //scores $proximite = 50; $xpr = round(($x2*$proximite)/100)+ $x1; $popularite = 30; $xpo = round(($x2*$popularite)/100)+ $x1; $centralite = 5; $xce = round(($x2*(6-$centralite))/6)+ $x1; imagefilledrectangle($image, $x1, $y1, $xpr, $y2 , $rouge); imagefilledrectangle($image, $x1, $y3, $xpo, $y4, $vert); imagefilledrectangle($image, $x1, $y5, $xce, $y6, $bleu); //Afficher l'image en tant que PNG imagepng($image);