File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ parameters:
77 pdf : ' %env(default:monsieurbiz_sylius_media_manager.default_max_file:resolve:MONSIEURBIZ_SYLIUS_MEDIA_MANAGER_MAX_FILE_SIZE_PDF)%'
88 favicon : ' %env(default:monsieurbiz_sylius_media_manager.default_max_file:resolve:MONSIEURBIZ_SYLIUS_MEDIA_MANAGER_MAX_FILE_SIZE_FAVICON)%'
99 file : ' %env(default:monsieurbiz_sylius_media_manager.default_max_file:resolve:MONSIEURBIZ_SYLIUS_MEDIA_MANAGER_MAX_FILE_SIZE_FILE)%'
10+ monsieurbiz_sylius_media_manager.liip_imagine.exclude_extensions :
11+ - ' svg'
12+ - ' ico'
1013
1114services :
1215 _defaults :
@@ -48,3 +51,4 @@ services:
4851 arguments :
4952 $loaders : ' %liip_imagine.loaders%'
5053 $publicDir : ' %sylius_core.public_dir%'
54+ $excludeExtensions : ' %monsieurbiz_sylius_media_manager.liip_imagine.exclude_extensions%'
Original file line number Diff line number Diff line change @@ -26,7 +26,8 @@ class FilterExtensionDecorator extends BaseFilterExtension
2626 public function __construct (
2727 CacheManager $ cache ,
2828 array $ loaders ,
29- string $ publicDir
29+ string $ publicDir ,
30+ private array $ excludeExtensions = ['svg ' , 'ico ' ],
3031 ) {
3132 parent ::__construct ($ cache );
3233 $ this ->loaders = $ loaders ;
@@ -62,6 +63,9 @@ public function filter(
6263
6364 private function canImageBeFiltered (string $ path ): bool
6465 {
65- return !str_ends_with ($ path , '.svg ' ) && !str_ends_with ($ path , '.ico ' );
66+ /** @var string $pathExtension */
67+ $ pathExtension = pathinfo ($ path , \PATHINFO_EXTENSION );
68+
69+ return !\in_array ($ pathExtension , $ this ->excludeExtensions , true );
6670 }
6771}
You can’t perform that action at this time.
0 commit comments