From 40787db1779fdb2cc2667dc5931e98a9bcc61c05 Mon Sep 17 00:00:00 2001 From: marlencrabapple Date: Wed, 17 Sep 2014 15:55:16 -0700 Subject: [PATCH] Fixed spoiler thumbnails not showing up in the recent theme --- templates/themes/recent/theme.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/templates/themes/recent/theme.php b/templates/themes/recent/theme.php index 842ab9ac..a25ff6a9 100644 --- a/templates/themes/recent/theme.php +++ b/templates/themes/recent/theme.php @@ -54,14 +54,27 @@ while ($post = $query->fetch(PDO::FETCH_ASSOC)) { openBoard($post['board']); + if (isset($post['files'])) $files = json_decode($post['files']); if ($files[0]->file == 'deleted') continue; // board settings won't be available in the template file, so generate links now - $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], ($post['thread'] ? $post['thread'] : $post['id'])) . '#' . $post['id']; - if ($files) $post['src'] = $config['uri_thumb'] . $files[0]->thumb; + $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] + . sprintf($config['file_page'], ($post['thread'] ? $post['thread'] : $post['id'])) . '#' . $post['id']; + + if ($files) { + if ($files[0]->thumb == 'spoiler') { + $tn_size = @getimagesize($config['spoiler_image']); + $post['src'] = $config['spoiler_image']; + $post['thumbwidth'] = $tn_size[0]; + $post['thumbheight'] = $tn_size[1]; + } + else { + $post['src'] = $config['uri_thumb'] . $files[0]->thumb; + } + } $recent_images[] = $post; }