function system_image_toolkit_settings

system_image_toolkit_settings()

Form builder; Configure site image toolkit usage.

See also

system_settings_form()

Related topics

File

modules/system/system.admin.inc, line 1852
Admin page callbacks for the system module.

Code

function system_image_toolkit_settings() {
  $toolkits_available = image_get_available_toolkits();
  $current_toolkit = image_get_toolkit();

  if (count($toolkits_available) == 0) {
    variable_del('image_toolkit');
    $form['image_toolkit_help'] = array(
      '#markup' => t("No image toolkits were detected. Drupal includes support for <a href='!gd-link'>PHP's built-in image processing functions</a> but they were not detected on this system. You should consult your system administrator to have them enabled, or try using a third party toolkit.", array('!gd-link' => url('http://php.net/gd'))),
    );
    return $form;
  }

  if (count($toolkits_available) > 1) {
    $form['image_toolkit'] = array(
      '#type' => 'radios',
      '#title' => t('Select an image processing toolkit'),
      '#default_value' => variable_get('image_toolkit', $current_toolkit),
      '#options' => $toolkits_available
    );
  }
  else {
    variable_set('image_toolkit', key($toolkits_available));
  }

  // Get the toolkit's settings form.
  $function = 'image_' . $current_toolkit . '_settings';
  if (function_exists($function)) {
    $form['image_toolkit_settings'] = $function();
  }

  return system_settings_form($form);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!system!system.admin.inc/function/system_image_toolkit_settings/7.x