You are here

function ais_preprocess_image in Adaptive Image Styles (ais) 7

Implements template_preprocess_image().

Adds a class to adaptive images for max-width.

File

./ais.module, line 259
Adaptive Image Styles Module

Code

function ais_preprocess_image(&$variables) {
  if (isset($variables['style_name'])) {
    if (ais_is_adaptive_style($variables['style_name'])) {
      if (!isset($variables['attributes']['class'])) {
        $variables['attributes']['class'] = array();
      }
      elseif (!is_array($variables['attributes']['class'])) {
        $variables['attributes']['class'] = array(
          $variables['attributes']['class'],
        );
      }
      $variables['attributes']['class'][] = AIS_ADAPTIVE_CLASS;
    }
  }
}