| 1.20.x image.module | image_style_save($style) | 
Save an image style.
Parameters
array $style: An image style array containing:
- name: An unique name for the style.
- effects: An optional array of effects.
Return value
array: An image style array containing:
- name: An unique name for the style.
- effects: An array of effects.
- is_new: Is set to TRUE if this is a new style, and FALSE if it is an existing style.
File
- modules/image/ image.module, line 583 
- Exposes global functionality for creating image styles.
Code
function image_style_save($style) {
  // Add in the effects key if missing.
  $style += array('effects' => array());
  $config = config('image.style.' . $style['name']);
  if (is_null($config->get('name'))) {
    $style['is_new'] = TRUE;
  }
  $config->set('label', $style['label']);
  $config->set('name', $style['name']);
  $config->set('effects', $style['effects']);
  // Only write storage settings for default and overridden styles.
  if (isset($style['module'])) {
    $config->set('module', $style['module']);
    $config->set('overridden', TRUE);
  }
  $config->save();
  // Delete the previous configuration file if any.
  if (isset($style['old_name']) && $style['old_name'] !== $style['name']) {
    if ($old_style = image_style_load($style['old_name'])) {
      image_style_flush($old_style);
      config('image.style.' . $old_style['name'])->delete();
    }
  }
  // Let other modules update as necessary on save.
  module_invoke_all('image_style_save', $style);
  // Clear all caches and flush.
  image_style_flush($style);
  return $style;
}