[PLUGIN][ImageEncoder] Only show thumbnails if they exist
This commit is contained in:
parent
58715f1733
commit
ce23660dba
|
@ -185,11 +185,16 @@ class ImageEncoder extends Plugin
|
||||||
return Event::next;
|
return Event::next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (\is_null($thumbnail = $vars['attachment']->getThumbnail())) {
|
||||||
|
return Event::next;
|
||||||
|
}
|
||||||
|
|
||||||
$res[] = Formatting::twigRenderFile(
|
$res[] = Formatting::twigRenderFile(
|
||||||
'imageEncoder/imageEncoderView.html.twig',
|
'imageEncoder/imageEncoderView.html.twig',
|
||||||
[
|
[
|
||||||
'attachment' => $vars['attachment'],
|
'attachment' => $vars['attachment'],
|
||||||
'note' => $vars['note'],
|
'note' => $vars['note'],
|
||||||
|
'thumbnail' => $thumbnail,
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
return Event::stop;
|
return Event::stop;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<figure>
|
<figure>
|
||||||
{% set thumbnail = attachment.getThumbnail() %}
|
|
||||||
<img class="u-photo"
|
<img class="u-photo"
|
||||||
alt="{{ attachment.getBestTitle(note) }}"
|
alt="{{ attachment.getBestTitle(note) }}"
|
||||||
src="{{ attachment.getThumbnailUrl() }}"
|
src="{{ attachment.getThumbnailUrl() }}"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user