Image thumbnails being cleared after updating

Hello! I recently started using Grav for my personal website and I love it so far, with the exception of one really irritating issue: I have multiple image gallery pages, some with over 100 images, using cropZoom to make thumbnails. Every time I update Grav or otherwise have to clear the cache, all of those thumbnails are wiped along with it, which means next time those pages are loaded it takes a really long time cropping all the images again.

Apologies if this is a bit of a dumb question, but is there any way I can set up Grav to put the thumbnail images in a folder that won’t get wiped after every update? Or set it to not touch the images folder at all?

@Nicede, When performing a search on either Google or here on Discourse using ‘grav clear cache images’ you’ll find the following existing post Images deleted after Clear Cache.

The post points to the Cache configuration section of the documentation:

clear_images_by_default: By default grav will include processed images when cache clears, this can be disabled by setting this to false

What setting is your installation using?

Note, the default behaviour has been changed from true to false in release 1.7.16. The docs however, have not been updated yet… I’ve created a PR to fix this.

@pamtbaau, I looked at my /config/system.yaml and this setting appears to be set to false.

With clear_images_by_default: false, in my fresh Grav 1.7.18 install, the ‘/images’ folder is not being cleared when using $ bin/grav cache

Steps:

  • Copy image to ‘/user/pages/02.typography/’
  • Add ![image](image.jpg?cropzoom=100,100) to ‘/user/pages/02.typography/default.md’
  • Browse to typography page
  • File ‘/path/to/…b3735e2f843ff128e6f32ad-image.jpg’ is being created.
  • Run $ bin/grav cache
  • File ‘/path/to/…b3735e2f843ff128e6f32ad-image.jpg’ still exists
  • Set value cache:clear_images_by_default:true in ‘/user/config/system.yaml’
  • Run $ bin/grav cache
  • File ‘/path/to/…b3735e2f843ff128e6f32ad-image.jpg’ has been cleared

Unfortunately, cache:clear_images_by_default:false does not preserve the ‘/images’ folder when running $ bin/gpm selfupdate.

If this is too much of an issue for you, you might might consider creating an issue on github.

My issue is that it out the images folder after updating Grav through the Admin Panel. I may just end up creating an issue through Github.

@Nicede, There is IMHO no difference between upgrading from Admin or the command prompt. Both use ‘/system/src/Grav/Common/GPM/Installer.php::install()’

So, if you do create an issue, I would use the Grav repo as mentioned above.