Module Description
Utility module to flush a single image from any image styles it may have generated for it.

This module provides a simple form to which you can provide a source image path (e.g. public://assets/foo/bar/image.jpg) and it will flush any styled image(s) that have been generated.

Background
This module was originally developed to solve an issue where daily imports from a closed third party system would replace image content on occasion but keep the filenames the same resulting in out of date images in the image style cache.

Service Class
See example below on how to use the service class included.

$path = 'public://assets/foo/bar/image.jpg'; $paths = \Drupal::service('flush_single_image')->flush($path); foreach ($paths as $flushed_path) { \Drupal::messenger->addMessage(t('Flushed @path', ['@path' => $flushed_path])); } Drush Command
Image styles can also be flushed on a single image via Drush command. See code example below for usage.

drush flush_single_image public://assets/foo/bar/image.jpg --check-styles Migrate Plugin
Migrate plugin included in module as well. See below for an example of how to use.

process: path_to_file: - plugin: file_copy source: - /path/to/file.png - public://new/path/to/file.png - plugin: flush_single_image action: 'regenerate'
Project Usage
93
Creation Date
Changed Date
Security Covered
Covered By Security Advisory
Version Available
Production
Module Summary
This module solves the issue of out of date images in the image style cache by providing a simple form to flush any styled image(s) that have been generated for a single image.
Data Name
flush_single_image

OPENAI CHATBOT

OPENAI CHATBOT

14:27:07
Generic Chatbot
Hi, I'm a Drupal module expert powered by OpenAI, answering your questions about the Drupal module ecosystem. How can I be helpful today? Please note that we will log your question.