I work on a site with a lot of custom image styles that need to be accessible to a content administrator. I've modified the Image style flush module to allow users to flush the image cache directly from the admin toolbar.

Here are the changes if any-one else is in a similar situation.

  1. Apply the attached patch.
  2. Modify user permissions select 'Use Image Style Flush' for the desired roles
  3. Add a link to Management>Administration:
  • Add a link to admin/config/media/image-styles/flush to flush the whole cache
  • Add a link to admin/config/media/image-styles/flush/[specificstyle] where [specifictyle] is the name of a single style you want to flush

Comments

tomb-2’s picture

Collins405’s picture

Issue summary: View changes

This is great, the only other suggestion I would make it to change line 171 from...

drupal_goto('admin/config/media/image-styles');

to...

drupal_goto('admin/config/media/image-styles/flush');

Otherwise the user hits an access denied page.

  • hargobind committed ccf1b35 on 7.x-1.x authored by tomb
    Issue #2048091 by tomb, hargobind: Allow certain user roles to flush...
hargobind’s picture

Status: Needs review » Fixed

Great idea. Thanks for the patch. And thanks @Collins405 for noticing the pitfall with the redirect -- I modified it to redirect the user to the homepage if they don't have access to "administer image styles". I also added an update which assigns the new permission to all roles that have the "administer image styles" permission.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.