Skip to content

Commit

Permalink
Merge pull request #11 from maximehuran/feature/add-image-type-manage…
Browse files Browse the repository at this point in the history
…ment

Add image mime types
  • Loading branch information
maximehuran authored Aug 29, 2023
2 parents 1f82bd8 + e683af1 commit 4b4b618
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/Helper/FileHelperInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ interface FileHelperInterface
'image/gif',
'image/jpeg',
'image/png',
'image/svg+xml',
'image/webp',
'image/avif',
];

public const VIDEO_TYPE_MIMES = [
Expand All @@ -61,6 +64,7 @@ interface FileHelperInterface
'image/vnd.microsoft.icon',
'image/x-icon',
'image/ico',
'image/svg+xml',
'image/gif',
'image/jpeg',
'image/png',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{% set filePath = folder is not empty ? folder ~ '/' ~ file.path : file.path %}
{% if file.isImage %}
{% if file.isImage and file.mimeType != 'image/svg+xml' %}
<a href="/media/{{ filePath }}" target="_blank" rel="noopener noreferrer">
<img src="{{ filePath|imagine_filter('monsieurbiz_sylius_media_manager_uploaded_image') }}" alt="{{ filePath|escape('html_attr') }}" style="max-width: 300px;max-height: 30px;" />
</a>
{% elseif file.isImage and file.mimeType == 'image/svg+xml' %}
<a href="/media/{{ filePath }}" target="_blank" rel="noopener noreferrer">
<img src="/media/{{ filePath }}" alt="{{ filePath|escape('html_attr') }}" style="max-width: 300px;max-height: 30px;" />
</a>
{% elseif file.isFile %}
<a href="/media/{{ filePath }}" target="_blank" rel="noopener noreferrer" class="ui button mini icon">
<i class="eye icon"></i>
Expand Down

0 comments on commit 4b4b618

Please sign in to comment.