You are here

function resp_img_add_style_form_submit in Responsive images and styles 7

File

./resp_img.admin.inc, line 121
Admin settings

Code

function resp_img_add_style_form_submit($form, &$form_state) {
  $base = image_style_load($form_state['values']['style']);
  if (!isset($base['effects'])) {
    $base['effects'] = array();
  }
  foreach ($base['effects'] as &$effect) {
    unset($effect['isid']);
    unset($effect['ieid']);
  }
  $base['effects'] = array_values($base['effects']);
  foreach (array_filter($form_state['values']['suffixes']) as $suffix) {
    $new_style = array(
      'name' => $form_state['values']['base_name'] . $suffix,
      'module' => 'resp_img',
      'storage' => IMAGE_STORAGE_NORMAL,
      'effects' => $base['effects'],
    );
    image_default_style_save($new_style);
  }
  $form_state['redirect'] = 'admin/config/media/image-styles';
  drupal_set_message(t('The new styles have been created'));
}