To load the class Imagine
to a controller I executed the following line in the terminal: composer require imagine/imagine
Which, in the vendor
folder, created a folder called imagine
with many classes.
Then in the file "Module.php" of my controller I added the following function:
public function getServiceConfig()
{
return array(
'invokables' => array(
'image_service' => 'Imagine\Gd\Imagine',
));
}
In my IndexController.php I place this line
$imagine = $this->getServiceLocator()->get('image_service');
And I get an error:
Zend \ ServiceManager \ ServiceManager :: createFromInvokable: failed retrieving "imageservice (alias: image_service)" via invokable class "Imagine \ Gd \ Imagine"; class does not exist
The most terrible thing is that my localhost works as well and does not give an error, but the server gives the error.