Gregwar / ImageBundle

Image manipulation bundle for Symfony 2
MIT License
195 stars 50 forks source link

Symfony 3 - You have requested a non-existent service "templating.helper.assets". #92

Closed robbanl closed 8 years ago

robbanl commented 8 years ago

Hello,

I'm having some troubles using this bundle in my Symfony 3 application.

Tried using {{ image('/code/symfony/web/img/404.png').resize(100,100) }} in the twig template, but got the error:

Error: Method Gregwar\ImageBundle\ImageHandler::__toString() must not throw an exception

After some searches on Google I found that I should call jpeg() method to have a better error. Received this error:

An exception has been thrown during the rendering of a template ("You have requested a non-existent service "templating.helper.assets".") in AppBundle::default/frontpage.html.twig at line 13.

Also tried directly in the controller, $foo = $this->get('image.handling')->open('/code/symfony/web/img/404.png')->jpeg(); but got the same error.

Is it me who missed something or anything that changed in Symfony 3?

robbanl commented 8 years ago

Of course, when I wrote it and did some more research I found the issue:

Will create a pull request!

robbanl commented 8 years ago

91 already exists, but I think that will break SF2 versions... Hmmm...

Gregwar commented 8 years ago

Could we simply test wether the services exist?

Gregwar commented 8 years ago

Maybe something like $container->has('templating.helper.assets')

robbanl commented 8 years ago

Sounds like a plan! I'll give it a try!

robbanl commented 8 years ago

@Gregwar PR is ready when you are :)

MaZderMind commented 8 years ago

@Gregwar would you mind pushing a release? Currently no released version of the ImageBundle is compatible with the current Symfony 3.x because of this issue.

alexiswbr commented 8 years ago

@Gregwar ping

Gregwar commented 8 years ago

Tagged v2.0.23, is it OK?

leperse commented 8 years ago

The templating.helper.assets service was replaced in Symfony 3.0.* by assets.packages

Gregwar commented 8 years ago

@leperse yes, this is fixed in #93