Search code examples
imagesymfonydefaultliipimaginebundle

Symfony2 LiipImagineBundle default image


I'm using LiipImagineBundle for an application built with symfony2 and I want to display a default image, when a image does not exists. Let's say I have

<img src="{{ ('/profiles/foo.JPG') | imagine_filter('bar') }}" />

How could I display default.jpg when '/profiles/foo.JPG' does not exists?

Thanks,


Solution

  • Ok Martin Lie i have foud a link for you and i hope you will directly undeerstand the scenario because by default Twig can not test if a Phisicall object exists or not.. so you must create a service that will help you to make it directely in Twig...

    Create a service for twig

    Don't worry !