You are here

function _lazyloader_excluded_by_image_style in Image Lazyloader 7.2

Helper function to determine if an image should be excluded by image style.

1 call to _lazyloader_excluded_by_image_style()
theme_lazyloader_image in ./lazyloader.module
Returns HTML for an image.

File

./lazyloader.module, line 260
Lazyloader Module

Code

function _lazyloader_excluded_by_image_style($variables) {
  $excluded_styles = _lazyloader_filter_selected_values(variable_get('lazyloader_image_styles', array()));

  // If no image styles are selected we have nothing to exclude.
  if (empty($excluded_styles)) {
    return FALSE;
  }
  $styles = implode('|', array_keys(image_styles()));

  // Make sure the image is actually a derived image.
  if (preg_match('/styles\\/[' . $styles . ']/', $variables['path'])) {
    return (bool) (!in_array($variables['style_name'], $excluded_styles));
  }
  else {

    // Not a derived image, nothing to do here.
    return FALSE;
  }
}