Skip to main content

Refresh Sylius Image Cache

· One min read
Stephan Hochdörfer
Head of IT Business Operations

After transferring images from one Sylius instance to another, I need to refresh the image cache so that Sylius can correctly display the images on the frontend. How can I achieve this?

Following some research and testing, I discovered the necessary commands to complete the task.

To generate the image cache for each file in the public/media/image directory, you can use the Symfony Console command liip:imagine:cache:resolve, which takes a file as an argument and updates its corresponding cache:

cd public/media
find image -type f -print0 | xargs -0 -I {} php ../../bin/console liip:imagine:cache:resolve {}