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.
- Apply the attached patch.
- Modify user permissions select 'Use Image Style Flush' for the desired roles
- Add a link to Management>Administration:
- Add a link to
admin/config/media/image-styles/flushto 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
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | image_style_flush_admin_button_2048091_1.patch | 1.24 KB | tomb-2 |
Comments
Comment #1
tomb-2 commentedComment #2
Collins405 commentedThis 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.
Comment #4
hargobindGreat 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.