Image styles by themes

Component ID

2119107

Component name

Image styles by themes

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

3601

Component created

Component changed

Component body

This is a super simple utility module which allows any enabled theme to:

  1. Declare new image styles
  2. Reliably alter the configuration of any existing image styles

Usage

  1. Install this module
  2. Ensure your theme is enabled,
  3. On the settings page for your theme, ensure the "Allow this theme to declare image styles" and/or "Allow this theme to alter image styles" box is ticked, as your needs require.
  4. Create a file of the following name at the ROOT of your theme directory:

    THEMENAME.image_styles.inc

  5. Implement whichever of the following two hooks you need:

    THEMENAME_theme_image_default_styles()

    THEMENAME_theme_image_styles_alter()

    These hooks correspond with the usual image module hooks, with a slight name
    change to avoid conflicts. See image_styles_by_themes.api.php for more info.

  6. Clear caches!

Warning

As soon as you disable your theme, all image styles it declared will be removed
from the system. This may lead to seriously broken content if they were being
used.