I just created a custom module following this tut: generate-programmatically-image-styles-drupal-8

It works great but the following occurs. When I create a new node and upload the image you see that for every style I have it creates a image (like the custom module should). But when I save the node all the created images are deleted?

Is this a standard function in Drupal that can be disabled? Hope someone can help me with this.

Thanks in advance

  • I'm getting the same issue too. I thought it had something to do with the Crop API, but it happens on nodes without Crops. I'll do some debugging.
    – firewaller
    Apr 17, 2018 at 21:50

1 Answer 1


It turns out that image_path_flush() is being fired in Drupal\file_entity\Entity\FileEntity->postSave() even when the image is not actually updated. You can see the issue and proposed resolution outlined here: https://www.drupal.org/project/file_entity/issues/2816761

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.