How to regenerate images when you do a style change, and images don't reflect them

April 04, 2020

Introduction

There might be a situation when you are doing some changes in the image style, and you want to see those changes on already saved content. But, when do changes, you couldn’t view them. As Drupal makes a cache of those images, but even after clearing cache you did not see expected changes in your images.

Solution

There are two solutions to this problem:

  • Clear image style cache
# make sure you have drush installed

drush image:flush 

# It will list down all your image styles, and ask you to press number which you want to reset

Choose a style to flush [all]:
  [0] Cancel
  [1] all
  [2] 220x180
  [3] 350x250
  [4] 400x310
  [5] 520x280
  [6] large
  [7] medium
  [8] thumbnail

# Type the number and press Enter.

# Or, you can directly type style name, like below:

drush image:flush large
  • Directly delete the folder in sites/default/files folder where this style resides. Example:

    rm -fr sites/default/files/styles/large

Now, refresh your content pages and it will work as expected.


Similar Posts

Latest Posts