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
|
for($i = count($tableau) - 1; $i >= 0 ; $i -= 1)
{
$image= imagecreatetruecolor($largeur, $hauteur);
// remplissage de l'image avec une couleur de transparence
$transparence = imagecolorallocatealpha($image, 252, 254, 252, 127);
imagefill($image, 0, 0, $transparence);
ImageAlphaBlending($image, true);
imagesavealpha($image, true);
// inclusion de la fonction ...
include_once 'fabrique_un_onglet.inc';
// définition des coordonnées de départ pour la copie des onglets
$y = -35;
for($j = count($tableau) - 1; $j >= 0 ; $j -= 1)
{
$x = 110 * ($j % 5);
$height = 50;
$width = 181;
if($j == $i && $tableau[$j] != $onglet_actif)
{
$etat = 'survol';
}
else
if($j != $i && $tableau[$j] != $onglet_actif) $etat = 'inactif';
else
{
$etat = 'actif';
$height = 69;
$width = 185;
}
if(($j % 5) == 4)
{
$y += 35;
//$x = 440;
}
$onglet = fabrique_un_onglet(strtoupper($tableau[$j]), $etat);
imagecopy($image, $onglet, $x, $y, 0, 0, $width, $height);
imagesavealpha($image,true);
$x -= 110;
$ligne -= 1;
}
imagetruecolortopalette($image, false, 256);
$transparence = imagecolorclosest($image, 252, 254, 252);
imagecolortransparent($image, $transparence);
for($k = 192; $k < 250 ; $k += 1)
{
$index = imagecolorresolve($image, $k, $k, $k);
imagecolorset($image, $index, 252, 254, 252);
}
imagesavealpha($image, true);
imagepng($image, "images/tests/nav_$i.png");
imagedestroy($image); |
Partager