Created
October 20, 2013 16:01
-
-
Save tsi/7071493 to your computer and use it in GitHub Desktop.
Drupal Image API - Skip GIFs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function THEME_image_style($variables) { | |
// Skip GIFs. | |
$ext = pathinfo($variables['path'], PATHINFO_EXTENSION); | |
if ($ext == 'gif') { | |
return theme('image', $variables); | |
} | |
// Determine the dimensions of the styled image. | |
$dimensions = array( | |
'width' => $variables['width'], | |
'height' => $variables['height'], | |
); | |
image_style_transform_dimensions($variables['style_name'], $dimensions); | |
$variables['width'] = $dimensions['width']; | |
$variables['height'] = $dimensions['height']; | |
// Determine the URL for the styled image. | |
$variables['path'] = image_style_url($variables['style_name'], $variables['path']); | |
return theme('image', $variables); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment