You are here

function imageapi_optimize_pipeline_usage in Image Optimize (or ImageAPI Optimize) 7.2

Gets an array of all image styles and if they use a pipeline.

Return value

An array of styles keyed by the image style ID (isid).

See also

image_style_load()

1 call to imageapi_optimize_pipeline_usage()
imageapi_optimize_pipeline_usage_list in ./imageapi_optimize.admin.inc
Menu callback; Listing of all current image pipeline usage.

File

./imageapi_optimize.module, line 948

Code

function imageapi_optimize_pipeline_usage() {
  $usages = array();
  $pipelines = imageapi_optimize_pipelines();
  foreach (image_styles() as $style_name => $style) {
    $usage = array();
    $usage['name'] = $style_name;
    $usage['label'] = empty($style['label']) ? $style_name : $style['label'];

    // Check to see if there's a pipeline specified.
    if (isset($style['effects'])) {
      foreach ($style['effects'] as $effect) {
        if ($effect['module'] == 'imageapi_optimize' && $effect['name'] == 'imageapi_optimize' && isset($effect['data']['pipeline'])) {
          if (isset($pipelines[$effect['data']['pipeline']])) {
            $usage['pipeline_name'] = $effect['data']['pipeline'];
            $usage['pipeline_label'] = $pipelines[$effect['data']['pipeline']]['label'];
          }
        }
      }
    }
    $usages[] = $usage;
  }
  return $usages;
}