Skip to content

Commit

Permalink
Merge pull request #162 from Kunstmaan/fix_svg_thumbnails
Browse files Browse the repository at this point in the history
Fix svg thumbnails on media detail pages
  • Loading branch information
Wim Vandersmissen committed Aug 20, 2014
2 parents 63af445 + ef96f4e commit 799a604
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Resources/config/liip_imagine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ liip_imagine:
media_detail_thumbnail:
quality: 75
filters:
thumbnail: { size: [500, 500], mode: outbound }
thumbnail: { size: [700, 500], mode: inset }
10 changes: 9 additions & 1 deletion Resources/views/Media/Image/show.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,13 @@
{% endblock %}

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

0 comments on commit 799a604

Please sign in to comment.