From 274eb5b69eda8b21cfad82a3be1e2950085e5419 Mon Sep 17 00:00:00 2001 From: Maxime Huran Date: Tue, 29 Aug 2023 11:05:09 +0200 Subject: [PATCH 1/2] manage other image formats --- src/Helper/FileHelperInterface.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Helper/FileHelperInterface.php b/src/Helper/FileHelperInterface.php index 0d490e6..7188bc2 100644 --- a/src/Helper/FileHelperInterface.php +++ b/src/Helper/FileHelperInterface.php @@ -43,6 +43,9 @@ interface FileHelperInterface 'image/gif', 'image/jpeg', 'image/png', + 'image/svg+xml', + 'image/webp', + 'image/avif', ]; public const VIDEO_TYPE_MIMES = [ @@ -61,6 +64,7 @@ interface FileHelperInterface 'image/vnd.microsoft.icon', 'image/x-icon', 'image/ico', + 'image/svg+xml', 'image/gif', 'image/jpeg', 'image/png', From e683af139fcd8d6f1163f1ef1fa6a30e071812c0 Mon Sep 17 00:00:00 2001 From: Maxime Huran Date: Tue, 29 Aug 2023 11:05:24 +0200 Subject: [PATCH 2/2] Special preview for SVGs (Not resized) --- .../MediaManager/Modal/Content/Files/_previewFile.html.twig | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Resources/views/Admin/MediaManager/Modal/Content/Files/_previewFile.html.twig b/src/Resources/views/Admin/MediaManager/Modal/Content/Files/_previewFile.html.twig index 82fb32f..734398b 100644 --- a/src/Resources/views/Admin/MediaManager/Modal/Content/Files/_previewFile.html.twig +++ b/src/Resources/views/Admin/MediaManager/Modal/Content/Files/_previewFile.html.twig @@ -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' %} {{ filePath|escape('html_attr') }} +{% elseif file.isImage and file.mimeType == 'image/svg+xml' %} + + {{ filePath|escape('html_attr') }} + {% elseif file.isFile %}