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>
<body>
<h2>Creating an Image Gallery<h2>
<ul>
<?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>
<img height="150" width="200"
src="<?php echo $photosList[$x]; ?>" />
<?php echo basename($photosList[$x]); ?><br/>
<?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