You are here

function animgif_support_image in Animated gif support for image styles 7

Returns HTML for an image.

@group themeable

1 string reference to 'animgif_support_image'
animgif_support_theme_registry_alter in ./animgif_support.module
Implements hook_theme_registry_alter().

File

./animgif_support.module, line 56
Provides animated gif resizing support for the image styles.

Code

function animgif_support_image($variables) {
  $attributes = $variables['attributes'];
  $attributes['src'] = file_create_url($variables['path']);
  $parts = explode('?', $variables['path']);
  $mime = file_get_mimetype($parts[0]);
  if ('image/gif' == $mime) {

    // Remove dimensions if the image is gif - the effect's dimensions callback
    // gives back false data for animated GIFs (GIFs either).
    unset($variables['width']);
    unset($variables['height']);
  }
  foreach (array(
    'width',
    'height',
    'alt',
    'title',
  ) as $key) {
    if (isset($variables[$key])) {
      $attributes[$key] = $variables[$key];
    }
  }
  return '<img' . drupal_attributes($attributes) . ' />';
}