In theme_imagecache()
function theme_imagecache($namespace, $path, $alt = '', $title = '', $attributes = NULL) {
if ($image = image_get_info(imagecache_create_path($namespace, $path))) {
$attributes['width'] = $image['width'];
$attributes['height'] = $image['height'];
}
// check is_null so people can intentionally pass an empty array of attributes to override
// the defaults completely... if
if (is_null($attributes)) {
$attributes['class'] = 'imagecache imagecache-'. $namespace;
}
...
The default classes are only added if $attributes is null, however, that will never be true if the image_get_info() call succeeds because it then defines width and height attributes. This causes the default classes to be added sometimes but not other depeding on the image_get_info() call.
The classes section should be moved to the top like this to achieve the correct functionality:
function theme_imagecache($namespace, $path, $alt = '', $title = '', $attributes = NULL) {
// check is_null so people can intentionally pass an empty array of attributes to override
// the defaults completely... if
if (is_null($attributes)) {
$attributes['class'] = 'imagecache imagecache-'. $namespace;
}
if ($image = image_get_info(imagecache_create_path($namespace, $path))) {
$attributes['width'] = $image['width'];
$attributes['height'] = $image['height'];
}
Comments
Comment #1
drewish commentedComment #2
drewish commentedrolling in some adjacent PHPDoc and variable name fixes.
Comment #3
drewish commentedcommitted to HEAD.