You are here

function imce_resize_submit in IMCE 6.2

Same name and namespace in other branches
  1. 6 inc/page.inc \imce_resize_submit()
  2. 7 inc/imce.page.inc \imce_resize_submit()

Submit resize form.

1 string reference to 'imce_resize_submit'
imce_resize_form in inc/imce.page.inc
Resizing form.

File

inc/imce.page.inc, line 359
Implements the file browser.

Code

function imce_resize_submit($form, &$form_state) {
  $form_state['redirect'] = FALSE;
  $imce =& $form['#parameters'][2]['imce'];

  //check dimensions
  $width = (int) $form_state['values']['width'];
  $height = (int) $form_state['values']['height'];
  list($maxw, $maxh) = $imce['dimensions'] ? explode('x', $imce['dimensions']) : array(
    0,
    0,
  );
  if ($width < 1 || $height < 1 || $maxw && ($width > $maxw || $height > $maxh)) {
    drupal_set_message(t('Please specify dimensions within the allowed range that is from 1x1 to @dimensions.', array(
      '@dimensions' => $imce['dimensions'] ? $imce['dimensions'] : t('unlimited'),
    )), 'error');
    return;
  }
  $resized = imce_process_files($form_state['values']['filenames'], $imce, 'imce_resize_image', array(
    $width,
    $height,
    $form_state['values']['copy'],
  ));
  if (!empty($resized)) {
    drupal_set_message(t('File resizing successful: %files.', array(
      '%files' => utf8_encode(implode(', ', $resized)),
    )));
  }
}