Skip to content

Commit 1abd6f5

Browse files
authored
Merge pull request #66 from jolicode/fix/heifpreprocessor-only-when-imagine
Load the HeifPreProcessor only if Imagine is installed
2 parents fe6304f + 7f1f415 commit 1abd6f5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/JoliMediaBundle.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace JoliCode\MediaBundle;
44

5+
use Doctrine\DBAL\Types\StringType;
56
use Imagine\Image\ImagineInterface;
67
use Imagine\Image\Metadata\ExifMetadataReader;
78
use Imagine\Gd\Imagine as GdImagine;
@@ -32,7 +33,7 @@ class JoliMediaBundle extends AbstractBundle
3233
{
3334
public function boot(): void
3435
{
35-
if (!class_exists(\Doctrine\DBAL\Types\StringType::class)) {
36+
if (!class_exists(StringType::class)) {
3637
return;
3738
}
3839

@@ -100,8 +101,8 @@ public function loadExtension(array $config, ContainerConfigurator $container, C
100101
;
101102

102103
// pre-processors
103-
if (!in_array(HeifPreProcessor::class, $config['pre_processors'])) {
104-
// Automatically add the Heif pre-processor if not manually configured
104+
if (!in_array(HeifPreProcessor::class, $config['pre_processors']) && interface_exists(ImagineInterface::class)) {
105+
// Automatically add the Heif pre-processor if it is not manually configured and Imagine is available
105106
array_unshift($config['pre_processors'], HeifPreProcessor::class);
106107
}
107108

@@ -969,7 +970,6 @@ private function createPostProcessorServices(ContainerConfigurator $container, a
969970

970971
$postProcessorContainerService->call('add', ['oxipng', service('.joli_media.post_processor.oxipng')]);
971972
}
972-
973973
}
974974

975975
private function createPreProcessorServices(ContainerConfigurator $container, array $preProcessorsConfig): void

0 commit comments

Comments
 (0)