diff --git a/composer.json b/composer.json index ab92ffb..85cd9db 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "require": { "php": "^8.2", "illuminate/support": "^11.1", - "intervention/image": "^3.6", + "intervention/image": "^3.7", "reliqarts/laravel-common": "^8.0", "ext-json": "*", "ext-fileinfo": "*", diff --git a/src/Service/ImageManager.php b/src/Service/ImageManager.php index 6d831f8..31c8be5 100644 --- a/src/Service/ImageManager.php +++ b/src/Service/ImageManager.php @@ -4,16 +4,22 @@ namespace ReliqArts\GuidedImage\Service; +use Intervention\Image\Exceptions\DriverException; use Intervention\Image\ImageManager as InterventionImageManager; use Intervention\Image\Interfaces\DecoderInterface; use Intervention\Image\Interfaces\ImageInterface; +use Intervention\Image\Interfaces\ImageManagerInterface; use ReliqArts\GuidedImage\Contract\ImageManager as ImageManagerContract; use RuntimeException; -final readonly class ImageManager implements ImageManagerContract +final class ImageManager implements ImageManagerContract { - public function __construct(private InterventionImageManager $manager) + /** + * @throws DriverException + */ + public function __construct(private ?ImageManagerInterface $manager = null) { + $this->manager = $manager ?? InterventionImageManager::gd(); } /**