diff --git a/README.md b/README.md index 233231c..bb03990 100644 --- a/README.md +++ b/README.md @@ -36,18 +36,27 @@ return [ ## Configuration By default, the bundle is configured to use the GD library with Intervention -Image. However, the package also offers other drivers. This can be easily -configured by creating a file `config/packages/intervention_image.yaml` and +Image. However, the package also offers other drivers. This and other options of the +library can be easily configured by creating a file `config/packages/intervention_image.yaml` and setting the driver class as follows. ```yaml intervention_image: driver: Intervention\Image\Drivers\Imagick\Driver + options: + autoOrientation: true + decodeAnimation: true + blendingColor: 'ffffff' ``` You can choose between the two supplied drivers `Intervention\Image\Drivers\Gd\Driver` and `Intervention\Image\Drivers\Imagick\Driver` for example. +You can read more about the different options for +[auto orientation](https://image.intervention.io/v3/modifying/effects#image-orientation-according-to-exif-data), +[decoding animations](https://image.intervention.io/v3/modifying/animations) and +[blending color](https://image.intervention.io/v3/basics/colors#transparency). + ## Getting Started The integration is now complete and it is possible to access the [ImageManager](https://image.intervention.io/v3/basics/instantiation) diff --git a/composer.json b/composer.json index 5f6c7ef..a01a4fd 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ ], "require": { "php": "^8.1", - "intervention/image": "^3.5", + "intervention/image": "^3.7", "symfony/framework-bundle": "^6.4|^7" }, "autoload": { diff --git a/config/services.yaml b/config/services.yaml index f5855b7..b458172 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -5,3 +5,4 @@ services: autowire: true arguments: $driver: '%intervention_image.driver%' + $options: '%intervention_image.options%' diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 606a5ae..cf6dee2 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -14,7 +14,14 @@ public function getConfigTreeBuilder(): TreeBuilder $treeBuilder->getRootNode() ->children() ->scalarNode('driver') - ->defaultValue(GdDriver::class) + ->defaultValue(GdDriver::class) + ->end() + ->arrayNode('options')->addDefaultsIfNotSet() + ->children() + ->booleanNode('autoOrientation')->defaultValue(true)->end() + ->booleanNode('decodeAnimation')->defaultValue(true)->end() + ->scalarNode('blendingColor')->defaultValue('ffffff')->end() + ->end() ->end() ->end(); diff --git a/src/DependencyInjection/InterventionImageExtension.php b/src/DependencyInjection/InterventionImageExtension.php index 0e9c6e7..1e768dd 100644 --- a/src/DependencyInjection/InterventionImageExtension.php +++ b/src/DependencyInjection/InterventionImageExtension.php @@ -19,5 +19,6 @@ public function load(array $configs, ContainerBuilder $container): void $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); $container->setParameter('intervention_image.driver', $config['driver']); + $container->setParameter('intervention_image.options', $config['options']); } }