In my project i have some protected images outside the web root.
In my controller, i created a route that returns a BinaryFileResponse with the contents of the image i want to show:
/**
* @Route("/protected/images/{filename}", name="protected_image")
*/
public function getProtectedimage($filename)
{
//.. logic ..
return new BinaryFileResponse($path);
}
In my template i use Twig's path() to render that route and show the image:
<img src="{{ path('protected_image',{filename: myEntity.imagePath}) }}">
Now, i want to use that route together with LiipImagine to apply a filter and create thumbnails, like so:
<img src="{{ path('protected_image',{filename: myEntity.imagePath}) | imagine_filter('my_thumb_filter') }}">
The problem: always shows broken image and Source image not found in .. in logs.
Can i use LiipImagine together with a route that returns BinaryFileResponse? If so, how?