Detect failure to create a thumbnail for non-video uploads

Resolves #205.
This commit is contained in:
Trevor Slocum 2021-04-15 21:38:12 -07:00
parent 79adb305a3
commit 4e05d8512c
1 changed files with 6 additions and 0 deletions

View File

@ -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;