Add catalog thumbnails for file placeholder, handle the first of multiple OP images being deleted
Thank you based lewdposter
This commit is contained in:
parent
99493b054d
commit
b227982390
|
@ -394,6 +394,28 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function filepathForThumb($thumb_or_special, $path_when_file) {
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
if ($thumb_or_special === 'deleted') {
|
||||||
|
return $config['root'] . $config['image_deleted'];
|
||||||
|
} else if ($thumb_or_special === 'spoiler') {
|
||||||
|
return $config['root'] . $config['spoiler_image'];
|
||||||
|
} else if ($thumb_or_special === 'file') {
|
||||||
|
// see twig_extension_filter
|
||||||
|
$ext = mb_strtolower(mb_substr($path_when_file, mb_strrpos($path_when_file, '.') + 1));
|
||||||
|
$icons = $config['file_icons'];
|
||||||
|
// see templates/post/image.html
|
||||||
|
if (isset($icons[$ext])) {
|
||||||
|
return $config['root'] . sprintf($config['file_thumb'], $icons[$ext]);
|
||||||
|
} else {
|
||||||
|
return $config['root'] . sprintf($config['file_thumb'], $icons['default']);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return $config['uri_thumb'] . $thumb_or_special;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private function generateRecentPosts($threads) {
|
private function generateRecentPosts($threads) {
|
||||||
global $config, $board;
|
global $config, $board;
|
||||||
|
|
||||||
|
@ -413,28 +435,23 @@
|
||||||
if (isset($post['files']) && $post['files']) {
|
if (isset($post['files']) && $post['files']) {
|
||||||
$files = json_decode($post['files']);
|
$files = json_decode($post['files']);
|
||||||
|
|
||||||
if ($files[0]) {
|
if (isset($files[0]) && $files[0]) {
|
||||||
if ($files[0]->file == 'deleted') {
|
$foundone = false;
|
||||||
if (count($files) > 1) {
|
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
if (($file == $files[0]) || ($file->file == 'deleted'))
|
if ($file->file != 'deleted') {
|
||||||
continue;
|
$post['file'] = $this->filepathForThumb($file->thumb, $file->file);
|
||||||
$post['file'] = $config['uri_thumb'] . $file->thumb;
|
$foundone = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($post['file']))
|
|
||||||
$post['file'] = $config['root'] . $config['image_deleted'];
|
|
||||||
} else {
|
|
||||||
$post['file'] = $config['root'] . $config['image_deleted'];
|
|
||||||
}
|
|
||||||
} else if($files[0]->thumb == 'spoiler') {
|
|
||||||
$post['file'] = $config['root'] . $config['spoiler_image'];
|
|
||||||
} else {
|
|
||||||
$post['file'] = $config['uri_thumb'] . $files[0]->thumb;
|
|
||||||
}
|
}
|
||||||
|
if (!$foundone) {
|
||||||
|
$post['file'] = $this->filepathForThumb('deleted', null);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$post['file'] = $config['root'] . $config['image_deleted'];
|
$post['file'] = $this->filepathForThumb('deleted', null);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$post['file'] = $this->filepathForThumb('deleted', null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($post['images']))
|
if (empty($post['images']))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user