From c1090339963951019b30684864e1c30347ba213a Mon Sep 17 00:00:00 2001 From: Stefan Brand Date: Tue, 11 Jan 2022 16:37:31 +0100 Subject: [PATCH] Only Process Images if > 0 --- index.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/index.php b/index.php index d3b59e9..6a5470e 100644 --- a/index.php +++ b/index.php @@ -84,13 +84,15 @@ if (count($curfiles) > 0 | count($dirs) > 0) { // Prepare Mode Specific Data and Render Template if ($slice > 1) { - foreach ($curfiles as $index => $image) { - $tmp['n'] = $image; - $tmp['i'] = $index+1; - $tmp['t'] = $thumburl.$t->get_thumb($image); - $data['images'][] = $tmp; - $data['dirs'] = $dirs; + if (count($curfiles) > 0) { + foreach ($curfiles as $index => $image) { + $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);