intervention / image-symfony
Symfony Integration of Intervention Image
Fund package maintenance!
Intervention
Ko Fi
paypal.me/interventionio
Installs: 3 260
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 1
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^8.1
- intervention/image: ^3.7
- symfony/framework-bundle: ^6.4|^7
README
Symfony Integration for Intervention Image
This package provides an integration to setup Intervention Image easily to your Symfony framework application. Although the use of this integration library is not absolutely necessary, it offers a convenient way of central configuration in the Symfony framework.
Requirements
- Symfony >= 6.4
Installation
In your existing Symfony application you can install this package using Composer.
composer require intervention/image-symfony
After successful installation, you can activate the bundle in the file
config/bundes.php
of your application by inserting the following line into
the array.
return [ // ... Intervention\Image\Symfony\InterventionImageBundle::class => ['all' => true], ];
Configuration
By default, the bundle is configured to use the GD library with Intervention
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.
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, decoding animations and blending color.
Getting Started
The integration is now complete and it is possible to access the ImageManager via dependency injection.
namespace App\Controller; use Intervention\Image\ImageManager; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; class ExampleController extends AbstractController { #[Route('/')] public function example(ImageManager $manager): Response { $image = $manager->read('images/example.jpg'); } }
Read the official documentation of Intervention Image for more information.
Authors
This library is developed and maintained by Oliver Vogel
Thanks to the community of contributors who have helped to improve this project.
License
Intervention Image Symfony is licensed under the MIT License.