You are here

function simplecrop_imagestyles_with_crop_effect in SimpleCrop 7

Returns list of image styles which use simplecrop effect.

1 call to simplecrop_imagestyles_with_crop_effect()
simplecrop_preprocess_image in includes/simplecrop.theme.inc
Implements template_preprocess_image().

File

./simplecrop.module, line 171
Contains main hook definitions for SimpleCrop module.

Code

function simplecrop_imagestyles_with_crop_effect() {

  // Provide static caching for the current operation results, because it can
  // be executed a lot of times per page request.
  $styles_with_crop =& drupal_static(__FUNCTION__);
  if (isset($styles_with_crop)) {
    return $styles_with_crop;
  }

  // Load all image styles.
  $styles = image_styles();
  $styles_with_crop = array();

  // Walk through each image style to find those who has effects from the
  // current module.
  foreach ($styles as $name => $style) {

    // We don't care about empty image styles.
    if (empty($style['effects'])) {
      continue;
    }
    foreach ($style['effects'] as $effect) {
      if (!empty($effect['module']) && $effect['module'] == 'simplecrop') {
        $styles_with_crop[$name] = $name;
      }
    }
  }

  // Return a list of image styles which use simplecrop effect.
  return $styles_with_crop;
}