I'm using Sonata ( http://sonata-project.org/bundles/media/2-2/doc/index.html ) in a project, and I have 50GB of thumbs at a resolution that I don't want anymore. I modified the resolution in the config file, but the thumbs still have the old resolution/size.
How can I force Sonata to rebuild all my thumbs?
This worked for me:
php app/console sonata:media:sync-thumbnails sonata.media.provider.image default
As far as I know, Sonata Media Bundle integrates LiipImagineBundle to create image thumbnails. If so, it creates the thumbs and saves in cache (actually, is a directory) on first request. So you have to clear the images cache, and LiipImagineBundle will rebuild them on the next request for each image.
To clear the LiipImagineBundle images cache, you can use the console command liip:imagine:cache:remove
. Its documentation says:
The
liip:imagine:cache:remove
command removes cache by specified parameters.Paths should be separated by spaces:
php app/console liip:imagine:cache:remove path1 path2
All cache for a givenpaths
will be lost.If you use
--filters
parameter:php app/console liip:imagine:cache:remove --filters=thumb1 --filters=thumb2
All cache for a given filters will be lost.You can combine these parameters:
php app/console liip:imagine:cache:remove path1 path2 --filters=thumb1 --filters=thumb2
php app/console liip:imagine:cache:remove
Cache for all paths and filters will be lost when executing this command without parameters.
So, to clear all cached images you should use: php app/console liip:imagine:cache:remove