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

damien tournoud’s picture

Status: Active » Closed (works as designed)

theme_image() will not change at this point.