View difference between Paste ID: wC1hecsq and wVjKMeES
SHOW: | | - or go back to the newest paste.
1
<?php
2
3
//////////////////////////////////////////////// 
4
///////////////////////////// 
5
//////////////////////////////////////////////// 
6
///////////////////////////// 
7
//// affichage des noms dans la cellule de mon tableau acteurs/actrices ///// 
8
//////////////////////////////////////////////// 
9
///////////////////////////// 
10
//////////////////////////////////////////////// 
11
///////////////////////////// 
12
$Nom_ACTORS = "";
13
$ACTORS = $row_Only_sur_CD['ACTORS'];
14
$longueur_ACTORS = strlen($ACTORS);
15
$ACTORSpresents = array();
16
$i = 0;
17
$j = 0;
18
$maxVIRGULE = 0;
19
$maxj = 0;
20
$maxVIRGULE = count((explode(",", $ACTORS)));
21
//affiche tous les acteurs/actrices sans leur extension 
22
23
if ($longueur_ACTORS > 0) {
24
    while ($i < $longueur_ACTORS) {
25
        if (isset($ACTORS)) {
26
            if (explode(",", $ACTORS)) {
27
                if ($maxVIRGULE != $j) {
28
                    $ACTORSpresents = (explode(", ", $ACTORS));
29
                    echo $ACTORSpresents[$j] . "-";
30
                    $maxj = $j;
31
                    $j++;
32
                }
33
            }
34
            $i++;
35
        }
36
    }
37
}
38
?> 
39
40
<?php
41
42
//////////////////////////////////////////////// 
43
// 
44
//////////////////////////////////////////////// 
45
// 
46
////affichage des photos des acteurs/actrices //// 
47
//////////////////////////////////////////////// 
48
// 
49
//////////////////////////////////////////////// 
50
// 
51
52
$NOM = array();
53
$compteur = 0;
54
$i = 0;
55
$compt = 0;
56
$debutEXTENSION = ".";
57
$image = array();
58
$compteur = 0;
59
$comptage = 0;
60
$imageACTORS_sans_extension = array();
61
62
// répertoire des images 
63
$dir = "../../../ADULTES sur CD/Acteurs et Actrices/";
64
$RepertoireNOM = opendir($dir); // ouverture du repertoire 
65
//////////////////////////////////////////// 
66
//// AFFICHAGE des acteurs et actrices ///// 
67
//////////////////////////////////////////// 
68
while ($Nom_ACTORS = readdir($RepertoireNOM)) {
69
    if (!is_file($Nom_ACTORS) && ($Nom_ACTORS != "index.php")) {
70
//on stocke le nom des fichiers des photos dans un tableau 
71
        $tableau[$compt] = $Nom_ACTORS;
72
// On a stocké un nom, donc on incrémente maintenant 
73
        $compt++;
74
    }
75
}
76
77
closedir($RepertoireNOM);
78
79
// Ensuite pourquoi compter les photos ? On sait qu'on a $compt // 
80
if ($compt > 0) {
81
    echo '<table>';
82
// et on fait une boucle d'affichage 
83
    for ($i = 0; $i < $compt; $i++) {
84
//echo $tableau[$i]."</br>"; 
85
    }
86
}
87
88
if ($compt > 0) {
89
    $nbcol = 8; // nombre de colonnes (pour les images.... - On compte le nombre de photos qui se trouve dans le dossier 
90
    $nbpics = count($tableau);
91
//$dir=opendir($RepertoireNOM); 
92
93
    if ($ACTORS != "") {
94
        $ACTORSpresents = explode(", ", ", " . $ACTORS);
95
        echo "CASTING :<br/>Il y a " . (sizeof($ACTORSpresents) - 1) . " Acteurs/Actrices";
96
        echo "<table>";
97
98
        $nbcol = 7;
99
        for ($i = 1; $i < sizeof($ACTORSpresents); $i++) {
100
            if ($i % $nbcol == 1) {
101
                echo "<tr>";
102
            }
103
            $extension = "";
104
            if (is_file($RepertoireNOM . $ACTORSpresents[$i] . ".jpg")) {
105
                $extension = ".jpg";
106
            } elseif (is_file($RepertoireNOM . $ACTORSpresents[$i
107
                            ] . ".png")) {
108
                $extension = ".png";
109
            } elseif (is_file($RepertoireNOM . $ACTORSpresents[$i
110
                            ] . ".jpeg")) {
111
                $extension = ".jpeg";
112
            } elseif (is_file($RepertoireNOM . $ACTORSpresents[$i
113
                            ] . ".gif")) {
114
                $extension = ".gif";
115
            } else {
116
                $extension = "";
117
            }
118
            echo "<td>";
119
120
            if ($extension != "") {
121
                echo "<img src='" . $rep . $ACTORSpresents[$i] . $extension . "' width=150 height=180>";
122
            } else {
123
                echo "Aucune photo pour<br/>";
124
            }
125
            echo "<br/>" . $ACTORSpresents[$i] . "</td>";
126
127
            if ($i % $nbcol == 0) {
128
                echo "</tr>";
129
            }
130
        }
131
        echo "</table>";
132
    }
133
134
//si on a au moins une photo, on les affiche toutes 
135
    if ($nbpics != 0) {
136
        echo '<table>';
137
    }
138
139
140
    while ($comptage = !$maxj) {
141
        echo $ACTORSpresents[$i] . "</br>";
142
        echo $tableau[$comptage] . "</br>";
143
        if (($ACTORSpresents[$i]) == ($tableau[$compteur])) {
144
            if ($i % $nbcol != 0) {
145
                echo '<tr>';
146
            } {
147
                echo '<img src="../../ADULTES sur CD/Acteurs et Actrices/' . $tableau[$compteur] . '"/>';
148
                echo $tableau[$compteur]; // pour voir si il est ok 
149
                $comptage = 0;
150
                $i++;
151
            }
152
            if ($i % $nbcol == ($nbcol - 1)) {
153
                echo '</tr>';
154
            }
155
            $compteur++;
156
        }
157
        $comptage++;
158
    }
159
160
    echo '</table>';
161
}
162
else
163
    echo 'Aucune image à afficher';
164
?>