image_style_save

7 image.module image_style_save($style)
8 image.module image_style_save($style)

Save an image style.

Parameters

style: An image style array.

Return value

An image style array. In the case of a new style, 'isid' will be populated.

6 calls to image_style_save()

File

modules/image/image.module, line 664
Exposes global functionality for creating image styles.

Code

function image_style_save($style) {
  if (isset($style['isid']) && is_numeric($style['isid'])) {
    // Load the existing style to make sure we account for renamed styles.
    $old_style = image_style_load(NULL, $style['isid']);
    image_style_flush($old_style);
    drupal_write_record('image_styles', $style, 'isid');
    if ($old_style['name'] != $style['name']) {
      $style['old_name'] = $old_style['name'];
    }
  }
  else {
    drupal_write_record('image_styles', $style);
    $style['is_new'] = TRUE;
  }

  // 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;
}
Login or register to post comments