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:
commit
0e8c75cfa2
|
@ -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');
|
||||
|
|
Loading…
Reference in New Issue