基本的に、スクリプトはディレクトリから画像を読み取り、それらをhtmlに出力します。したがって、この非常に優れたスクリプトで画像をアルファ数値でソートするようにしようとしています。現在、画像の並べ替え方法はかなりランダムです。
if ($handle = opendir($dir)) {
while (false!== ($file = readdir($handle))) {
sort($file);
$ext = strrchr($file,".");
echo "";
if(in_array($ext,$good_ext))
{
//do something with file
echo "<img src='images/".$modelname."/slider/".$file."'>";
}
else
{
echo "bad";
}
}
closedir($handle);
}
else
{
echo "$dir Directory does not exist!";
}
?>