Hello again.
I have a photo album that show all images in a specified directory.
but I like to sort them by filename as one possibillity and random
sort the photos as another feature.
I don't know how to do this.. Here is my soruce-code:
<!DOCTYPE html>
<html lang="no">
<head>
<meta charset="utf-8">
<title>Bildegalleri</title>
<link rel="stylesheet" href="standard.css" media="screen">
</head>
<body>
<h1>Bildegalleri</h1>
<p><a href="bildegalleri.html">Last opp nye bilder</a> |
<a href="vis_bildegalleri.php?sorter_filnavn">Sorter på filnavn</a>
|
<a href="vis_bildegalleri.php?tilfeldig_sortering">Tilfeldig
sortering</a></p>
<ul>
<?php
// Skann katalogen og hent fram bildene
$bilde = new DirectoryIterator('bilder/');
while($bilde->valid()){
if(!$bilde->isDot()){
if($_GET['sorter_filnavn']){
echo '<li><img
src="bilder/'.sort($bilde->getFilename()).'"
alt="'.sort($bilde->getFilename()).'" height="200"></li>';
} elseif($_GET['tilfeldig_sortering']) {
echo '<li><img
src="bilder/'.rand($bilde->getFilename()).'"
alt="'.rand($bilde->getFilename()).'" height="200"></li>';
} else {
echo '<li><img
src="bilder/'.$bilde->getFilename().'"
alt="'.$bilde->getFilename().'" height="200"></li>';
}
}
$bilde->next();
}
unset($bilde);
?>
</ul>
</body>
</html>
I will be lucky if somebode have time to help me out here.. I am sure
it is some functions in php that can do the trick, but haven't found
anything yet.
Thanks for your time.
Karl
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php