You are here

function imagecache_preset_save in ImageCache 6.2

Same name and namespace in other branches
  1. 5.2 imagecache.module \imagecache_preset_save()

Save an ImageCache preset.

Parameters

preset: an imagecache preset array.

Return value

a preset array. In the case of a new preset, 'presetid' will be populated.

1 call to imagecache_preset_save()
imagecache_ui_preset_form_submit in ./imagecache_ui.pages.inc

File

./imagecache.module, line 1074
Dynamic image resizer and image cacher.

Code

function imagecache_preset_save($preset) {

  // @todo: CRUD level validation?
  if (isset($preset['presetid']) && is_numeric($preset['presetid'])) {
    drupal_write_record('imagecache_preset', $preset, 'presetid');
  }
  else {
    drupal_write_record('imagecache_preset', $preset);
  }

  // Reset presets cache.
  imagecache_preset_flush($preset);
  imagecache_presets(TRUE);

  // Rebuild Theme Registry
  drupal_rebuild_theme_registry();
  return $preset;
}