You are here

function image_resize_filter_form in Image Resize Filter 7

Same name and namespace in other branches
  1. 6 image_resize_filter.module \image_resize_filter_form()

The form for configuring the Image Resize Filter.

1 string reference to 'image_resize_filter_form'
image_resize_filter_filter_info in ./image_resize_filter.module
Implements hook_filter_info().

File

./image_resize_filter.module, line 135
After adding to a text format, this filter will parse the contents of submitted content and automatically scale image files to match the set dimensions of img tags.

Code

function image_resize_filter_form($form, &$form_state, $filter, $format, $defaults) {
  $filter->settings += $defaults;
  $settings['image_resize'] = array(
    '#description' => t('The image resize filter will analyze <img> tags and compare the given height and width attributes to the actual file. If the file dimensions are different than those given in the <img> tag, the image will be copied and the src attribute will be updated to point to the resized image.'),
    '#theme' => 'image_resize_filter_form',
    '#format' => $format,
    '#parents' => array(
      'filters',
      'image_resize_filter',
      'settings',
    ),
  );
  $settings['image_resize']['image_locations'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Resize images stored'),
    '#options' => array(
      'local' => t('Locally'),
      'remote' => t('On remote servers (note: this copies <em>all</em> remote images locally)'),
    ),
    '#default_value' => $filter->settings['image_locations'],
    '#description' => t('This option will determine which images will be analyzed for &lt;img&gt; tag differences. Enabling resizing of remote images can have performance impacts, as all images in the filtered text needs to be transferred via HTTP each time the filter cache is cleared.'),
  );
  $settings['image_resize']['link'] = array(
    '#type' => 'checkbox',
    '#title' => t('If resized, add a link to the original image.'),
    '#default_value' => $filter->settings['link'],
  );
  $settings['image_resize']['link_class'] = array(
    '#type' => 'textfield',
    '#title' => t('Optionally, give it the class'),
    '#size' => '10',
    '#default_value' => $filter->settings['link_class'],
  );
  $settings['image_resize']['link_rel'] = array(
    '#type' => 'textfield',
    '#title' => t('and/or a rel attribute'),
    '#size' => '10',
    '#default_value' => $filter->settings['link_rel'],
  );
  return $settings;
}