sorting a directory?
Posted: Mon Jul 14, 2003 8:59 am
Hey all,
I'm sorry for asking this question ('cause i have the idea it's an newbee question)
But i tried all kind of sorting and nothing seems to work.
Maybe one of you can help me? :roll:
I want to display images sorted by alphabet but they seem to be sorted by last saved date.
here is the code:
BTW this code is not writen by me...
Please can somebody help?
I'm sorry for asking this question ('cause i have the idea it's an newbee question)
But i tried all kind of sorting and nothing seems to work.
Maybe one of you can help me? :roll:
I want to display images sorted by alphabet but they seem to be sorted by last saved date.
here is the code:
Code: Select all
<?
// IvoDKA photo Script
// Configuration
$woord="Foto"; // name of the php file
$path2 = "$gallery/thumbs"; // dir where the thumbnails are in
$path = "$gallery"; // dir where the photos are in
$title = "$gallery - Pagina ". ($page + 1);
//translation pagina means page and foto means photo
// header, this is above the photos
$header = "$gallery";
// Configuration
$clm = "5"; // number of colloms
$rows = "4"; // number of rows
$t_w = "120";
$t_h = "90";
?>
<style type="text/css">
<!--
@import url(../styleie.css);
body { background-color: rgb(80,80,80) }
body, p, td { color: rgb(180,180,180); font: 12px verdana, arial, sans-serif }
a:link, a:active, a:visited { color: wheat; text-decoration: none; font-size: 12px }
a:hover { text-decoration: underline }
/* heading size fixes for Netscape */
h1, h2, h3, h4, h5, h6 { text-align: center; font-weight: bold }
h1 { font-size: 150% }
h2 { font-size: 135% }
h3 { font-size: 125% }
-->
</style>
</head>
<body bgcolor='#CCCCFF' leftmargin='0' topmargin='0'>
<div align="center">
<?
echo "<h1>$header</h1>";
echo "<br><br><center><b><b><h2>$title</h2></b></b><br><br>";
$min = (1+($page * 20));
$max = (($page +1) * 20);
$number = $clm * $rows;
$break = (($page * 20) + $clm);
echo "<table border=0 cellpadding=0 cellspacing=0><tr>";
$d = dir("$path2");
$count = -1;
while($entry=$d->read())
{
if (($count >= $min) AND ($count <= $max)){
if(eregi(".jpg|.jpeg|.gif|.bmp|.png", $entry)){
ClearStatCache();
$size = GetImageSize("$path/$entry");
$size[0] = $size[0] + 20;
$size[1] = $size[1] + 25;
$file_size=fileSize("$path/$entry");
$file_size = round($file_size / 1000) . "k";
echo ("<td><a href="#" onmouseover="window.status='Vergroten';return true;"
onmouseout="window.status=''; return true"
onclick="window.open('$path/$entry','pix$count','width=$size[0],height=$size[1],innerwidth=$size[0],innerheight=$size[1],directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no,top=0,left=0,leftmargin=0,topmargin=0,marginwidth=0,marginheight=0,screenX=0,screenY=0');return false"><img src='$path2/$entry'");
echo " border=0 alt=$count ></a> <br>$entry<br><br> </td>\n"; // width=$t_w
}
if ($count == $break){
echo "</tr>\n<tr>\n";
$break = $count + $clm ;
}
}
$count++;
}
$d->close();
echo "</tr></table>";
$pages = ($count / 20);
$pageplus = ($page + 1);
$pagemin = ($page - 1);
if (($page + 1) < $pages){
$volgende = " | <a href=$woord.php?gallery=$gallery&page=$pageplus>Volgende 20 Foto's</a> |";
}
//volgende means next and vorige means last
//woord means word
if (($page+1) > "1"){
$vorige = "| <a href=$woord.php?gallery=$gallery&page=$pagemin>Vorige 20 Foto's</a> |";
}
// Footer, this is below the photos
echo "$vorige $volgende<br><br>Copyright 2002-2003 DopeTroep.NL<br>mochten er foto's tussen zitten die van u zijn <br>en u deze liever niet op deze pagina laat staan <br>kunt u contact op nemen met dope@dopetroep.nl";
//above is just some dutch comentary no script
?>Please can somebody help?