Une gallerie d images désobeissante. Pourquoi?

Lunasoft Messages postés 75 Date d'inscription samedi 28 juin 2008 Statut Membre Dernière intervention 16 août 2011 - 29 déc. 2010 à 19:51
TychoBrahe Messages postés 1309 Date d'inscription samedi 31 janvier 2009 Statut Membre Derniè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.


<head>
<title>Creating An image Gallery</title>
</head>
<style> type="text/css">
ul {
list-style-type: none;
}
li {
float: left;
padding: 10px;
margin: 10px;
font: bold 10 px Verdana, sans-serif;
}
img {
display: block;
border: 1px solid #333300;
margin-bottom: 5px;
</style>

<h2>Creating an Image Gallery<h2>

<?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

1 réponse

TychoBrahe Messages postés 1309 Date d'inscription samedi 31 janvier 2009 Statut Membre Dernière intervention 5 juin 2013 12
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.
0
Rejoignez-nous