Hi,
Im trying to add “Intervention Image” into my containerbuilder PHP-DI
The “intervention Image “ works when I create the instance inside the controllerclass
class ImageController extends BaseController
{
public function store() {
**//The following line of code works but I needs to be added to the containerbuilder**
$manager = new \Intervention\Image\ImageManager();
//Need to call the "make" from the containerbuilder interface
$manager->make($upload->file);
}}
This is my Containerbuilder
namespace Ti;
use DI\Bridge\Slim\App as DIBridge;
use DI\ContainerBuilder;
class App extends DIBridge
{
protected function configureContainer(ContainerBuilder $builder)
{
$builder->addDefinitions([
'settings.displayErrorDetails' => true,
]);
$builder->addDefinitions(__DIR__ . '/../config/container.php');
}
}
Containerbuilder addDefinitions
return [RouterInterface::class => function (ContainerInterface $container)
{
return $container->get('router');
},
Twig::class => function (ContainerInterface $c)
{
….
},
ResponseInterface::class => function (ContainerInterface $c)
{
….
},
// The problem is with the code below...Call to a member function make() on null
Image::class => function (ContainerInterface $c)
{
$manager = new \Intervention\Image\ImageManager();
$manager->configure($config->get('image'));
return $manager;
}