Skip to content

Commit 799a604

Browse files
author
Wim Vandersmissen
committed
Merge pull request #162 from Kunstmaan/fix_svg_thumbnails
Fix svg thumbnails on media detail pages
2 parents 63af445 + ef96f4e commit 799a604

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Resources/config/liip_imagine.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ liip_imagine:
1111
media_detail_thumbnail:
1212
quality: 75
1313
filters:
14-
thumbnail: { size: [500, 500], mode: outbound }
14+
thumbnail: { size: [700, 500], mode: inset }

Resources/views/Media/Image/show.html.twig

+9-1
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,13 @@
3636
{% endblock %}
3737

3838
{% block preview %}
39-
<p><img id="editimage" class="thumbnail" src="{{ handler.getImageUrl(media, app.request.basePath) | imagine_filter('media_detail_thumbnail') }}" alt="{{ media.name }}" /></p>
39+
{% set imageurl = handler.getImageUrl(media, app.request.basePath) %}
40+
{% if imageurl is not empty and media.location == 'local' %}
41+
{% if imageurl|lower|split('.')|last == 'svg' or 'image/svg' in media.contentType %}
42+
{% set imageurl = imageurl %}
43+
{% else %}
44+
{% set imageurl = imageurl | imagine_filter('media_detail_thumbnail') %}
45+
{% endif %}
46+
{% endif %}
47+
<p><img id="editimage" class="thumbnail" src="{{ imageurl }}" alt="{{ media.name }}" /></p>
4048
{% endblock %}

0 commit comments

Comments
 (0)