hi
i have a problem with sorting my readdir results. a directory should be opened and read, and only jpg files, not starting with thumb or medium should be returned.
this works fine, and also a standalone readdir script i have written works fine, and sorts the results alphabetically. but i can't manage to combine those two.
i am afraid it is just a silly problem, but i feel like im blinded :-(
perhaps someone can give me a clue. here is the code where i still have included the wrong sort():
<?php
//** DIRECTORY LISTING UND AUSGABE
chdir("/home/www/web671/html/foto/images/fotos/");
$mydir = getcwd();
$hdl = opendir($mydir);
echo "<font>";
echo"<span class='bold'>Foto: </span>(Directory: ",$mydir.")<br>\n";
echo"<select name='image' size='1'><option value='$bildname'>",$bildname.".jpg</option>\n<option>----------------------no image---------------------</option>\n";
while ($file = readdir($hdl))
sort($file);
{
if (ereg("medium" , $file)):
{
} else: {
if (ereg("thumb" , $file)):
{
} else: {
if (ereg(".jpg$" , $file)):
{
$file=ereg_replace (".jpg","", $file);
echo "<option value='",$file."'>",$file.".jpg</option>\n";
} else: {
} endif;
} endif;
} endif;
}
rewinddir($hdl);
echo "</select></font>";
closedir($hdl);
?>
thanks for reading and greetings
kami