Closed (works as designed)
Project:
Drupal core
Version:
6.9
Component:
theme system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Feb 2009 at 18:12 UTC
Updated:
11 Jun 2011 at 17:00 UTC
theme_image IMO is not logically correct. If you call it with getsize TRUE which is the default but the file is not found on the server no image tag is returned at all which means even if you supply 'alt' you get nothing on your themed page.
It seems that if an 'alt' is supplied (or perhaps maybe always) the img tag should be returned even if the file can't be found and the size can't be computed.
Would you all agree? If so I'll whip up a patch
Here's the current code
function theme_image($path, $alt = '', $title = '', $attributes = NULL, $getsize = TRUE) {
if (!$getsize || (is_file($path) && (list($width, $height, $type, $image_attributes) = @getimagesize($path)))) {
$attributes = drupal_attributes($attributes);
$url = (url($path) == $path) ? $path : (base_path() . $path);
return '<img src="'. check_url($url) .'" alt="'. check_plain($alt) .'" title="'. check_plain($title) .'" '. (isset($image_attributes) ? $image_attributes : '') . $attributes .' />';
}
}
Comments
Comment #1
damien tournoud commentedtheme_image() will not change at this point.