image_file_delete() implements hook_file_delete(), which means it's called for every file deletion. However, not every file deletion is an image. It's currently calling the very expensive image_path_flush() anyway for every deletion.
It should somehow try to figure out whether this is an image (more specifically whether this is an imagefield).
/**
* Implements hook_file_delete().
*/
function image_file_delete($file) {
// Delete any image derivatives of this image.
image_path_flush($file->uri);
}
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | drupal-image_file_delete_flush_images_only-1238264-2.patch | 473 bytes | maciej.zgadzaj |
Comments
Comment #1
aaron commentedi think it should check for any local image deletion, not just imagefields, because it's flushing derivatives, which could be for any local image. maybe we can check the mimetype?
Comment #2
maciej.zgadzaj commentedNo image_file_delete() in D8.
For D7 though, something like attached patch perhaps?