Check spoiler_image size before ussuming it is 128×128px

This commit is contained in:
kaf 2014-09-27 16:21:54 +00:00
parent cb7b7d070c
commit fe60590d19

View File

@ -1567,10 +1567,12 @@ function mod_spoiler_image($board, $post, $file) {
$result = $query->fetch(PDO::FETCH_ASSOC); $result = $query->fetch(PDO::FETCH_ASSOC);
$files = json_decode($result['files']); $files = json_decode($result['files']);
$size_spoiler_image = @getimagesize($config['spoiler_image']);
file_unlink($board . '/' . $config['dir']['thumb'] . $files[$file]->thumb); file_unlink($board . '/' . $config['dir']['thumb'] . $files[$file]->thumb);
$files[$file]->thumb = 'spoiler'; $files[$file]->thumb = 'spoiler';
$files[$file]->thumbheight = 128; $files[$file]->thumbwidth = $size_spoiler[0];
$files[$file]->thumbwidth = 128; $files[$file]->thumbheight = $size_spoiler_image[1];
// Make thumbnail spoiler // Make thumbnail spoiler
$query = prepare(sprintf("UPDATE ``posts_%s`` SET `files` = :files WHERE `id` = :id", $board)); $query = prepare(sprintf("UPDATE ``posts_%s`` SET `files` = :files WHERE `id` = :id", $board));