diff --git a/index.php b/index.php index 83a0926..7e3c826 100644 --- a/index.php +++ b/index.php @@ -76,6 +76,7 @@ if (isset($_GET['f'])) { // Sort and Reverse Filelist natcasesort($files); $files = array_reverse($files); +$files = array_merge($dirs, $files); // Get Files for current Page $curfiles = array_slice($files, ($page-1)*$slice ,$slice, true); @@ -100,13 +101,17 @@ if (!empty($curfiles)| !empty($dirs)) { if ($slice > 1) { if (!empty($curfiles)) { foreach ($curfiles as $index => $image) { - $tmp['n'] = $image; - $tmp['i'] = $index+1; - $tmp['t'] = $thumburl.$t->get_thumb($image); - $data['images'][] = $tmp; + if (in_array($image, $dirs)) { + $data['dirs'][] = $image; + } else { + $tmp['n'] = $image; + $tmp['i'] = $index+1; + $tmp['t'] = $thumburl.$t->get_thumb($image); + $data['images'][] = $tmp; + } } } - $data['dirs'] = $dirs; + Template::view('tpl/gallery.html', $data); } else { $data['gallery_page'] = ceil($page/$gslice);