On a Drupal 8 site, image styles are no longer generating correctly.

The sample.png used in the image styles configuration page is generated fine (including when I manually delete the file from the image styles directory). I have recursively set to 0775 and 0664 the directory and file permissions for the entire sites/default/files directory, but the error persists. The log just shows access denied.

The Drupal version is 8.1.9.

How can I fix this error?

  • I would also check owner and group for sites/default/files.
    – ya.teck
    Commented Nov 4, 2016 at 14:21
  • Just checked - all owned by the main web-server user / FTP user. This includes all subfolders and files in /sites/default/files/styles/...
    – almcnicoll
    Commented Nov 8, 2016 at 13:47

3 Answers 3


I have had issues in the past where derivatives weren't generating correctly intermittently and it was due to disc space running out. When logs were purged the image derivatives would generate, but otherwise, the server was running out of space. So that's one idea.

  • Thanks for suggestion - hope it helps others. Sadly, we have plenty of space and it's still failing.
    – almcnicoll
    Commented Nov 8, 2016 at 13:29

I have at last worked out what is causing the issue - but not why it suddenly started happening.

Going through our hosting cPanel, I stumbled across xVarnish, which is enabled across the board. Disabling it on our website immediately made the image styles generate correctly.

It may be that I can configure it to ignore image styles (thoughts welcome!) but for now, I have so much caching enabled Drupal-side that I think I can do without Varnish.

However, unless someone has suddenly turned on Varnish without consulting me (unlikely, but hard to ascertain in my org) then I'm totally at sea as to why it suddenly started being a problem.


Sometimes this problem can be caused by wrong or absent of the image token. Try to insert config line in the settings.php to check:

$config['image.settings'] = ['allow_insecure_derivatives' => true];

If after this change your picture style is showing correctly, your picture URL has wrong parameter "itok", for example:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.