Lunasoft
Messages postés75Date d'inscriptionsamedi 28 juin 2008StatutMembreDernière intervention16 août 2011
-
29 déc. 2010 à 19:51
TychoBrahe
Messages postés1309Date d'inscriptionsamedi 31 janvier 2009StatutMembreDernière intervention 5 juin 2013
-
30 déc. 2010 à 15:42
Salut!
J ai écrit mes codes afin de faire une importation des photos. en un mot, je voulais créer une gallerie d images.
Curieursement, quant j appele ma page "explorer". Elle est toute blanche. Qu est se passe t-il? Je comprends pas ou se cache le mystère.
<?php>
//define location of photo images
//this must be a location accessible by the script owner
$photosDir = './photos';
//define which file extensions are images
$photosExt = array('gift', 'jpg','jpeg','tif','tiff','bmp','png');
//define array to hold filenames of images found
$photosList = array();
//read directory contents
//build photo list
if (file_exists($photosDir)) {
$dp = opendir($photosDir) or die ('ERROR'; Cannot open directory');
while ($file = readdir($dp)) {
if ($file != '.' && $file);
$fileData = pathinfo($file);
if (in_array($fileData['extension'], $photosExt)) {
$photosList[] = "$photosDir/$file";
}
}
}
closedir($dp);
} else {
die ('ERROR': Directory does not exist.');
}
// iterate over photo list
// display each image and filename
if (count($photosList); $x++) {
?>
<li>
" />
<?php echo basename($photosList[$x]); ?>
<?php echo round(filesize($photosList[$x])/1024) . ' KB'; ?>
</li>
<?php
}
} else {
die('ERROR: No images found in directory');
}
Étudiant
PHP le revolutionnaire, PHP le Conquérant
TychoBrahe
Messages postés1309Date d'inscriptionsamedi 31 janvier 2009StatutMembreDernière intervention 5 juin 201312 30 déc. 2010 à 15:42
Salut,
Dit moi, tu as relu ton code au moins ? Parce que rien que la coloration syntaxique devrais te donner pas mal d'erreurs très bêtes. C'est bourré de trucs qui n'ont aucun sens, c'est à se demander si tu as un jour appris la syntaxe de PHP.