Some Images missing from image cache

Some of my Images are missing from my image cache when I load my website. This is only happening in one location (online) - on my local MAMP setup the images are fine. They are running through the media filter and so the image urls are to the /images cache folder. Some of the images randomly didn’t work, so I deleted the image folder and recreated it and then those images worked, but others on different pages didn’t (they 404 the images aren’t in the folder).

Any ideas? I searched all the docs and forums but can’t find anything.

URL to a page with missing images:

Whereas this page: has exactly the same setup (same twig template) but a different set of images in its page folder - but this works.

That is a little strange. My initial guess would of been that the images/ folder was not writeable, or somehow blocked by the .htaccess, but the fact that some images are there, means that is not the case.

I think that probably you uplaoded the entire website (images/ folder included) and those uploaded folders are not writable by your webserver. I would clear the cache and let Grav recreate all the images. The best way to do this is to use the CLI:

bin/grav clear

BTW, clearing the cache does more than just deleting the images folder, it forces the cache to be rebuilt as well. This is the better approach to take for a more reliable outcome.

More information can be found in the documentation. If you have not used the CLI on your hosted server, you should get that setup as it makes administrating much easier. Most hosting providers allow SSH access and getting it setup quickly and securely is not a complicated job. Check out the Hosting Guides for more information.

Hey thanks for that.

I’m gitignoring the images folder and just letting Grav create it in each server instance (local, dev, live) so thats not it. Clearing the cache may still fix the issue except I got this error when I ran bin/grav clear:

All files are definitely writeable I set them the whole root dir to 777 just to be sure.

clearing cache

rmdir(/var/www/ 2): Directory not empty

clear-cache [–all] [–assets-only] [–images-only] [–cache-only]


Well it seems the rmdir was not able to delete the cache/twig/9 folder, and that must be a permission thing. Can you delete the contents of the cache/ folder manually and try running the command again?

Yeah that fixed it, thanks. Noted for next time this occurs - thanks for your awesome support

Glad that sorted it!