Merge branch 'master' into 'master'

SensitiveContentPlugin: don't crash in GNU/Social Classic for video attachments

See merge request ShitposterClub/SensitiveContent!1
This commit is contained in:
Moon Man 2018-05-02 00:46:56 -04:00
commit 0e8c75cfa2
1 changed files with 11 additions and 2 deletions

View File

@ -160,14 +160,23 @@ EOB;
$classes = "sensitive-blocker"; //'sensitive-blocker';
$thumbnail = null;
try {
$thumbnail = $file->getThumbnail();
} catch (Exception $e) {
$thumbnail = null;
}
$thumbWidthCss = $thumbnail ? $thumbnail->width.'px' : 'auto';
$thumbHeightCss = $thumbnail ? $thumbnail->height.'px' : 'auto';
$out->elementStart('div', array(
'class'=>'attachment-wrapper',
'style'=>'height: ' . $file->getThumbnail()->height . 'px; width: ' . $file->getThumbnail()->width . 'px;'
'style'=>'height: ' . $thumbHeightCss . '; width: ' . $thumbWidthCss . ';'
)); /*needs height of thumb*/
$out->elementStart('div', array(
'class'=>$classes,
'onclick'=>'toggleSpoiler(event)',
'style'=>'height: ' . $file->getThumbnail()->height . 'px; width: ' . $file->getThumbnail()->width . 'px;'
'style'=>'height: ' . $thumbHeightCss . '; width: ' . $thumbWidthCss . ';'
));
$out->raw(' ');
$out->elementEnd('div');