私はphpが初めてで、exifの作成日で画像を並べ替える方法を見つけようとしています。以下のコードは、私が従ったこのチュートリアルのコードです: Simple Php Gallery Pagination
データベースなしのメソッドを探しているexifデータを取得するために少し変更しました。目標は、ページ分割されたギャラリー(そして現在はページ分割されています)を最新のものでソートすることです
function getPictures() {
    global $page, $per_page, $has_previous, $has_next, $DirFoto, $DirThumb;
    if ( $handle = opendir($DirFoto) ) {
        echo '<ul id="pictures">';
        $count = 0;
        $skip = $page * $per_page;
        if ( $skip != 0 )
            $has_previous = true;
        while ( $count < $skip && ($file = readdir($handle)) !== false ) {
            if ( !is_dir($file) && ($type = getPictureType($file)) != '' )
                $count++;
        }
        while ( $count < $per_page && ($file = readdir($handle)) !== false ) {
            if ( !is_dir($file) && ($type = getPictureType($file)) != '' ) {
                $exif = exif_read_data("$DirFoto/$file", 0, true);                  
                if ( ! is_dir($DirThumb) ) {
                    mkdir($DirThumb);
                }
                if ( ! file_exists($DirThumb.'/'.$file) ) {
                    makeThumb( $file, $type );
                }
                echo '<li><a href="'.$DirFoto.'/'.$file.'" title="Photo taken on '.date("F d Y, H:i:s", strtotime($exif['IFD0']['DateTime'])).'">';
                    echo '<img src="'.$DirThumb.'/'.$file.'" alt="'.date("F d Y, H:i:s", strtotime($exif['IFD0']['DateTime'])).'"/>';   
                echo '</a></li>';
                $count++;
            }
        }
        echo '</ul>';
        while ( ($file = readdir($handle)) !== false ) {
            if ( !is_dir($file) && ($type = getPictureType($file)) != '' ) {
                $has_next = true;
                break;
            }
        }
    }
}