symfonyubuntucachingrightsliipimaginebundle

Liipimagine Bundle - Images not cached


I received a project and I'm trying to start it in Docker with NGINX environment. But it seems I have a bug with LiipImagine. The project use Symfony 4 and LIIPImagine version 2.0.x-dev.

A page should display images from cache, exemple of an image URL : https://localhost:8443/media/cache/live_feed_message/images/live_feed_message/5c486df1a78fe_lama-750389_960_720.jpg

The directory exists with rights :

drwxr-xr-x 2 1000 1000 4069 Jan 23 13:35 live_feed_message

All images are stored in public/images/live_feed_mesage/ and in public/media/cache/live_feed_message/images/live_feed_message the corresponding image doesn't exists.

I figured out that if I use the command from LiipImagine: php app/console liip:imagine:cache:resolve relative/path/to/image1.jpg

It gives this result :

http://localhost/media/cache/quizz_thumbnail/images/live_feed_message/name_file.jpg
http://localhost/media/cache/quizz_sponsors_icon/images/live_feed_message/name_file.jpg
http://localhost/media/cache/live_feed_message/images/live_feed_message/name_file.jpg

And then the corresponding image exists in cache (public/media/cache/live_feed_message/images/live_feed_message) and the image displays correctly on the page...

In network tab from development console, I checked the response from an HTTP request. And I get this Symfony response:

Unable to write to the "/srv/api/public/media/cache/live_feed_message/images/live_feed_message" directory.

Does someone know what could be the issue ?

Since 2 days I can't resolve this issue, so thanks for your help !

PS: I overrided a route from routing.yaml from the bundle. In the path there was /resolve and I overrided with this (in fact I deleted /resolve from liip_imagine_filter path):

_liip_imagine:
    resource: "@LiipImagineBundle/Resources/config/routing.yaml"


liip_imagine_filter:
    path:  /media/cache/{filter}/{path}
    defaults:
        _controller: '%liip_imagine.controller.filter_action%'
    methods:
        - GET
    requirements:
        filter: '[A-z0-9_-]*'
        path: .+

Solution

  • You should maybe try being more permissive with chmod -R 777 public/images. In local it's not a very big deal, it's in production that you should fine tune your permissions. That would probably clear out your errors and you could go on coding.

    An actual permission for production would be 755 IIRC.