Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Configuration Language Lock 1.0.2 Minor update available for module config_language_lock (1.0.2). Release: Canvas Override 1.0.1 Minor update available for module canvas_override (1.0.1). Release: Media Remote Image 8.x-1.2 Minor update available for module media_entity_remote_image (8.x-1.2). Release: IDNA Convert Service (punycode) 2.0.4 Minor update available for module idna (2.0.4). Release: Bootstrap Cloud 7.1.3 Minor update available for theme bootstrap_cloud (7.1.3). Release: Token Browser 1.0.2 Minor update available for module token_browser (1.0.2). Release: Varbase Project 11.0.8 Minor update available for module varbase_project (11.0.8). Release: Media Remote Image 2.0.0-beta1 First beta version released for module media_entity_remote_image (2.0.0-beta1). Usage Milestone: Term CSV Export Import Module term_csv_export_import crossed 1,000 active installs. Security Coverage: Module Scout Module module_scout now has official Drupal security advisory coverage.

Flush Single Image Styles

281 sites Security covered Drupal 8–11
View on drupal.org

This module offers a utility to clear cached versions of a single image from all generated image styles. It provides a form, a Drush command, and a service class for flushing these cached images, which is useful for scenarios where source images are updated without changing filenames.

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'

Depends on

Dependencies of the latest stable release

  • action Drupal core
  • image Drupal core

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
1
Tracked since
Mar 2026
Latest release
6 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Slowing

Releases

Version Type Core Release date
3.0.0 Stable 8–11 Mar 11, 2026