Phalcon\Image\Adapter\GD not work on Dependency Injector

I try to call Phalcon\Image\Adapter\GD from Dependency Injector, but it not working

$di->set('image', function() { // create an image manager instance with favored driver $image = new Phalcon\Image\Adapter\GD(); return $image; });

calling DI


get error

edited Nov '15

ah it didnt matter shared or not

$di->set('name', function(){}, TRUE);

Dear lzo,

$di->setShared('name', function(){}); $di->set('name', function(){}, TRUE);

still not working

edited Nov '15

Please try

$di->set('image', [
    'className' => 'Phalcon\Image\Adapter\GD',
    'arguments' => [
            'type'  => 'parameter',
            'value' => 'path/image.jpg' // default parameter may be a null I think

Calling DI

$di->getService('image')->setParameter(0, array(
    'type'  => 'parameter',
    'value' => 'path/image.jpg'