diff --git a/SensitiveContentPlugin.php b/SensitiveContentPlugin.php index 8eb7c4a..69315d1 100644 --- a/SensitiveContentPlugin.php +++ b/SensitiveContentPlugin.php @@ -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');