par
L_layton » 26 avr. 2019, 11:18
J'ai corrigé le code et le voici
$MonRepertoire="ImageCarousel";//Répertoire contenant
$tableauDossier= scandir($MonRepertoire);//scan le répertoire et met les fichier qu'il y trouve dedans
$compteurPNG=0;// les compteurs serviront à compter mes images
$compteurJPG=0;
$tableauImage="";
$compteurImage=0;
$extension="";
foreach ($tableauDossier as $value) //la boucle foreach permettra de compters les images par types et de récupérer leur noms
{
$NomExtension=explode(".", $value);
$Nom=$NomExtension[0];//Récupération du nom du fichier se trouvant dans le la collone 1 du tableau
$extension=$NomExtension[1];
if ($extension=PNG) {
$compteurPNG=$compteurPNG+1;
$tableauImage[$compteurPNG];
$compteurImage=$compteurImage+1;
}
if ($extension=JPG) {
$compteurJPG=$compteurJPG+1;
$tableauImage[$compteurJPG];
$compteurImage=$compteurImage+1;
}
}
Maintenant j'ai un autre problème.
Warning: Use of undefined constant PNG - assumed 'PNG' (this will throw an Error in a future version of PHP) in C:\laragon\www\Lrdj\Média.php on line 59
Notice: Uninitialized string offset: 1 in C:\laragon\www\Lrdj\Média.php on line 61
Warning: Use of undefined constant JPG - assumed 'JPG' (this will throw an Error in a future version of PHP) in C:\laragon\www\Lrdj\Média.php on line 65
Notice: Uninitialized string offset: 1 in C:\laragon\www\Lrdj\Média.php on line 67
Warning: Use of undefined constant PNG - assumed 'PNG' (this will throw an Error in a future version of PHP) in C:\laragon\www\Lrdj\Média.php on line 59
Notice: Uninitialized string offset: 2 in C:\laragon\www\Lrdj\Média.php on line 61
Warning: Use of undefined constant JPG - assumed 'JPG' (this will throw an Error in a future version of PHP) in C:\laragon\www\Lrdj\Média.php on line 65
Notice: Uninitialized string offset: 2 in C:\laragon\www\Lrdj\Média.php on line 67
Ducoup il faudrait que je change totalement le code ?