You are here

function imageapi_optimize_processor_definitions in Image Optimize (or ImageAPI Optimize) 7.2

Returns a set of image processors.

These image processors are exposed by modules implementing hook_image_processor_info().

Return value

An array of image processors to be used when transforming images.

See also

hook_image_processor_info()

image_processor_definition_load()

2 calls to imageapi_optimize_processor_definitions()
imageapi_optimize_pipeline_form in ./imageapi_optimize.admin.inc
Form builder; Edit an image pipeline name and effects order.
imageapi_optimize_processor_definition_load in ./imageapi_optimize.module
Loads the definition for an image processor.

File

./imageapi_optimize.module, line 535

Code

function imageapi_optimize_processor_definitions() {
  global $language;

  // hook_image_processor_info() includes translated strings, so each language is
  // cached separately.
  $langcode = $language->language;
  $processors =& drupal_static(__FUNCTION__);
  if (!isset($processors)) {
    if ($cache = cache_get("imageapi_optimize_processors:{$langcode}")) {
      $processors = $cache->data;
    }
    else {
      $processors = array();
      foreach (module_implements('imageapi_optimize_processor_info') as $module) {
        foreach (module_invoke($module, 'imageapi_optimize_processor_info') as $name => $processor) {

          // Ensure the current toolkit supports the processor.
          $processor['module'] = $module;
          $processor['name'] = $name;
          $processor['data'] = isset($processor['data']) ? $processor['data'] : array();
          $processors[$name] = $processor;
        }
      }
      uasort($processors, '_imageapi_optimize_processor_definitions_sort');
      drupal_alter('imageapi_optimize_processor_info', $processors);
      cache_set("imageapi_optimize_processors:{$langcode}", $processors);
    }
  }
  return $processors;
}