From 4e05d8512cd14188d54c442a22d963c971435c78 Mon Sep 17 00:00:00 2001 From: Trevor Slocum Date: Thu, 15 Apr 2021 21:38:12 -0700 Subject: [PATCH] Detect failure to create a thumbnail for non-video uploads Resolves #205. --- inc/functions.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/inc/functions.php b/inc/functions.php index 4e958f5..beaf39a 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -842,6 +842,12 @@ function attachFile($post, $filepath, $filename, $uploaded) { $thumb_info = getimagesize('thumb/' . $post['thumb']); $post['thumb_width'] = $thumb_info[0]; $post['thumb_height'] = $thumb_info[1]; + + if ($post['thumb_width'] <= 0 || $post['thumb_height'] <= 0) { + @unlink($file_location); + @unlink('thumb/' . $post['thumb']); + fancyDie(__('Sorry, your video appears to be corrupt.')); + } } return $post;