function imagefield_crop_widget_preview_process

cis7 imagefield_crop.module imagefield_crop_widget_preview_process($element, &$form_state, $form)
cle7 imagefield_crop.module imagefield_crop_widget_preview_process($element, &$form_state, $form)
elmsmedia7 imagefield_crop.module imagefield_crop_widget_preview_process($element, &$form_state, $form)
icor7 imagefield_crop.module imagefield_crop_widget_preview_process($element, &$form_state, $form)
meedjum_blog7 imagefield_crop.module imagefield_crop_widget_preview_process($element, &$form_state, $form)
mooc7 imagefield_crop.module imagefield_crop_widget_preview_process($element, &$form_state, $form)
1 string reference to 'imagefield_crop_widget_preview_process'
imagefield_crop_widget_process in sites/all/modules/ulmus/imagefield_crop/imagefield_crop.module
An element #process callback for the imagefield_crop field type.

File

sites/all/modules/ulmus/imagefield_crop/imagefield_crop.module, line 283
Imagefield_crop module

Code

function imagefield_crop_widget_preview_process($element, &$form_state, $form) {
  //dpm(__FUNCTION__);
  $file = $element['#file'];
  if ($file->fid == 0) {
    return $element;
  }
  // The widget belongs to the parent, so we got to find it first
  $parents = array_slice($element['#array_parents'], 0, -1);
  $parent = drupal_array_get_nested_value($form, $parents);
  $instance = field_widget_instance($parent, $form_state);
  if ($instance['widget']['settings']['resolution']) {
    list($width, $height) = explode('x', $instance['widget']['settings']['resolution']);
  }

  $image_info = image_get_info(drupal_realpath($file->uri));
  $settings = array(
    $parent['#id'] => array(
      'preview' => array(
        'orig_width' => $image_info['width'],
        'orig_height' => $image_info['height'],
        'width' => (integer) $width,
        'height' => (integer) $height,
      ),
    ),
  );

  $element['#attached']['js'][] = array(
    'data' => array('imagefield_crop' => $settings),
    'type' => 'setting',
    'scope' => 'header',
  );
  $element['#imagefield_crop'] = array(
    '#file' => $element['#file'],
    '#width' => $width,
    '#height' => $height,
    '#path' => file_create_url($file->uri),
  );
  return $element;
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.