SensitiveContentPlugin: don't crash in GNU/Social Classic,
when an attachment has no thumbnail (for example when it is a video)
This commit is contained in:
parent
a096bbe0cf
commit
186d730468
|
@ -160,14 +160,23 @@ EOB;
|
|||
|
||||
$classes = "sensitive-blocker"; //'sensitive-blocker';
|
||||
|
||||
$thumbnail = null;
|
||||
try {
|
||||
$thumbnail = $file->getThumbnail();
|
||||
} catch (Exception $e) {
|
||||
$thumbnail = null;
|
||||
}
|
||||
$thumbWidth = $thumbnail ? $thumbnail->width : 'auto';
|
||||
$thumbHeight = $thumbnail ? $thumbnail->height : 'auto';
|
||||
|
||||
$out->elementStart('div', array(
|
||||
'class'=>'attachment-wrapper',
|
||||
'style'=>'height: ' . $file->getThumbnail()->height . 'px; width: ' . $file->getThumbnail()->width . 'px;'
|
||||
'style'=>'height: ' . $thumbHeight . 'px; width: ' . $thumbWidth . 'px;'
|
||||
)); /*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: ' . $thumbHeight . 'px; width: ' . $thumbWidth . 'px;'
|
||||
));
|
||||
$out->raw(' ');
|
||||
$out->elementEnd('div');
|
||||
|
|
Loading…
Reference in New Issue