Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.1215 diff -u -r1.1215 common.inc --- includes/common.inc 10 Sep 2010 07:58:40 -0000 1.1215 +++ includes/common.inc 11 Sep 2010 00:14:39 -0000 @@ -5818,7 +5818,7 @@ // - http://dev.w3.org/html5/spec/Overview.html#alt // The title attribute is optional in all cases, so it is omitted by // default. - 'variables' => array('path' => NULL, 'alt' => '', 'title' => NULL, 'attributes' => array(), 'getsize' => TRUE), + 'variables' => array('path' => NULL, 'width' => NULL, 'height' => NULL, 'alt' => '', 'title' => NULL, 'attributes' => array()), ), 'breadcrumb' => array( 'variables' => array('breadcrumb' => NULL), Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.610 diff -u -r1.610 theme.inc --- includes/theme.inc 11 Sep 2010 00:03:41 -0000 1.610 +++ includes/theme.inc 11 Sep 2010 00:14:39 -0000 @@ -1475,6 +1475,8 @@ * An associative array containing: * - path: Either the path of the image file (relative to base_path()) or a * full URL. + * - width: The width of the image (if known). + * - height: The height of the image (if known). * - alt: The alternative text for text-based browsers. HTML 4 and XHTML 1.0 * always require an alt attribute. The HTML 5 draft allows the alt * attribute to be omitted in some cases. Therefore, this variable defaults @@ -1488,38 +1490,19 @@ * - title: The title text is displayed when the image is hovered in some * popular browsers. * - attributes: Associative array of attributes to be placed in the img tag. - * - getsize: If set to TRUE, the image's dimension are fetched and added as - * width/height attributes. */ function theme_image($variables) { - $path = $variables['path']; - $alt = $variables['alt']; - $title = $variables['title']; $attributes = $variables['attributes']; - $getsize = $variables['getsize']; + $attributes['src'] = file_create_url($variables['path']); - if (!$getsize || (is_file($path) && (list($width, $height) = @getimagesize($path)))) { - // The src attribute can be omitted, by passing NULL for $path and FALSE for - // $getsize. - if (isset($path)) { - $attributes['src'] = file_create_url($path); - } - // The alt attribute defaults to an empty string. By passing NULL as value, - // it can be omitted. - if (isset($alt)) { - $attributes['alt'] = $alt; - } - if (isset($title)) { - $attributes['title'] = $title; - } - if (!isset($attributes['width']) && !empty($width)) { - $attributes['width'] = $width; - } - if (!isset($attributes['height']) && !empty($height)) { - $attributes['height'] = $height; + foreach (array('width', 'height', 'alt', 'title') as $key) { + + if (isset($variables[$key])) { + $attributes[$key] = $variables[$key]; } - return ''; } + + return ''; } /** Index: modules/color/color.module =================================================================== RCS file: /cvs/drupal/drupal/modules/color/color.module,v retrieving revision 1.90 diff -u -r1.90 color.module --- modules/color/color.module 17 Aug 2010 22:05:22 -0000 1.90 +++ modules/color/color.module 11 Sep 2010 00:14:39 -0000 @@ -63,7 +63,7 @@ foreach (element_children($form) as $theme) { if ($screenshot = variable_get('color_' . $theme . '_screenshot')) { if (isset($form[$theme]['screenshot'])) { - $form[$theme]['screenshot']['#markup'] = theme('image', array('path' => $screenshot, 'alt' => '', 'title' => '', 'attributes' => array('class' => array('screenshot')), 'getsize' => FALSE)); + $form[$theme]['screenshot']['#markup'] = theme('image', array('path' => $screenshot, 'title' => '', 'attributes' => array('class' => array('screenshot')))); } } } Index: modules/image/image.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/image/image.admin.inc,v retrieving revision 1.21 diff -u -r1.21 image.admin.inc --- modules/image/image.admin.inc 30 Jul 2010 02:47:28 -0000 1.21 +++ modules/image/image.admin.inc 11 Sep 2010 00:14:40 -0000 @@ -793,7 +793,7 @@ $output .= '
'; $output .= t('original') . ' (' . l(t('view actual size'), $original_path) . ')'; $output .= ''; // End preview-image. @@ -803,7 +803,7 @@ $output .= '
'; $output .= check_plain($style['name']) . ' (' . l(t('view actual size'), file_create_url($preview_file) . '?' . time()) . ')'; $output .= ''; // End preview-image. Index: modules/image/image.field.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/image/image.field.inc,v retrieving revision 1.27 diff -u -r1.27 image.field.inc --- modules/image/image.field.inc 9 Sep 2010 23:28:16 -0000 1.27 +++ modules/image/image.field.inc 11 Sep 2010 00:14:40 -0000 @@ -338,7 +338,7 @@ if ($element['#file'] && $widget_settings['preview_image_style']) { $element['preview'] = array( '#type' => 'markup', - '#markup' => theme('image_style', array('style_name' => $widget_settings['preview_image_style'], 'path' => $element['#file']->uri, 'getsize' => FALSE)), + '#markup' => theme('image_style', array('style_name' => $widget_settings['preview_image_style'], 'path' => $element['#file']->uri)), ); } Index: modules/image/image.module =================================================================== RCS file: /cvs/drupal/drupal/modules/image/image.module,v retrieving revision 1.48 diff -u -r1.48 image.module --- modules/image/image.module 1 Sep 2010 20:08:17 -0000 1.48 +++ modules/image/image.module 11 Sep 2010 00:14:40 -0000 @@ -1080,12 +1080,12 @@ * - path: The path of the image file relative to the Drupal files directory. * This function does not work with images outside the files directory nor * with remotely hosted images. + * - width: The width of the image (if known). + * - height: The height of the image (if known). * - alt: The alternative text for text-based browsers. * - title: The title text is displayed when the image is hovered in some * popular browsers. * - attributes: Associative array of attributes to be placed in the img tag. - * - getsize: If set to TRUE, the image's dimension are fetched and added as - * width/height attributes. * * @ingroup themeable */ @@ -1093,15 +1093,7 @@ $style_name = $variables['style_name']; $path = $variables['path']; - // theme_image() can only honor the $getsize parameter with local file paths. - // The derivative image is not created until it has been requested so the file - // may not yet exist, in this case we just fallback to the URL. - $style_path = image_style_path($style_name, $path); - if (!file_exists($style_path)) { - $style_path = image_style_url($style_name, $path); - } - $variables['path'] = $style_path; - $variables['getsize'] = FALSE; + $variables['path'] = image_style_path($style_name, $path); return theme('image', $variables); } Index: modules/image/image.test =================================================================== RCS file: /cvs/drupal/drupal/modules/image/image.test,v retrieving revision 1.28 diff -u -r1.28 image.test --- modules/image/image.test 1 Sep 2010 20:08:17 -0000 1.28 +++ modules/image/image.test 11 Sep 2010 00:14:40 -0000 @@ -635,7 +635,6 @@ $image_uri = $node->{$field_name}[LANGUAGE_NONE][0]['uri']; $image_info = array( 'path' => $image_uri, - 'getsize' => TRUE, ); $default_output = theme('image', $image_info); $this->assertRaw($default_output, t('Default formatter displaying correctly on full node view.')); @@ -707,7 +706,6 @@ $node = node_load($nid, NULL, TRUE); $image_info = array( 'path' => image_style_url('medium', $node->{$field_name}[LANGUAGE_NONE][0]['uri']), - 'getsize' => FALSE, ); $default_output = theme('image', $image_info); $this->assertRaw($default_output, t("Preview image is displayed using 'medium' style.")); @@ -717,7 +715,6 @@ 'path' => $node->{$field_name}[LANGUAGE_NONE][0]['uri'], 'alt' => $this->randomName(), 'title' => $this->randomName(), - 'getsize' => TRUE, ); $edit = array( $field_name . '[' . LANGUAGE_NONE . '][0][alt]' => $image_info['alt'], @@ -754,7 +751,7 @@ field_info_cache_clear(); $field = field_info_field($field_name); $image = file_load($field['settings']['default_image']); - $default_output = theme('image', array('path' => $image->uri, 'getsize' => TRUE)); + $default_output = theme('image', array('path' => $image->uri)); $this->drupalGet('node/' . $node->nid); $this->assertRaw($default_output, t('Default image displayed when no user supplied image is present.')); @@ -764,7 +761,6 @@ $node = node_load($nid, NULL, TRUE); $image_info = array( 'path' => $node->{$field_name}[LANGUAGE_NONE][0]['uri'], - 'getsize' => TRUE, ); $image_output = theme('image', $image_info); $this->drupalGet('node/' . $nid); Index: modules/user/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.module,v retrieving revision 1.1199 diff -u -r1.1199 user.module --- modules/user/user.module 7 Sep 2010 22:38:30 -0000 1.1199 +++ modules/user/user.module 11 Sep 2010 00:14:40 -0000 @@ -1413,10 +1413,10 @@ if (isset($filepath)) { $alt = t("@user's picture", array('@user' => format_username($account))); if (module_exists('image') && $style = variable_get('user_picture_style', '')) { - $variables['user_picture'] = theme('image_style', array('style_name' => $style, 'path' => $filepath, 'alt' => $alt, 'title' => $alt, 'attributes' => array(), 'getsize' => FALSE)); + $variables['user_picture'] = theme('image_style', array('style_name' => $style, 'path' => $filepath, 'alt' => $alt, 'title' => $alt, 'attributes' => array())); } else { - $variables['user_picture'] = theme('image', array('path' => $filepath, 'alt' => $alt, 'title' => $alt, 'attributes' => array(), 'getsize' => FALSE)); + $variables['user_picture'] = theme('image', array('path' => $filepath, 'alt' => $alt, 'title' => $alt)); } if (!empty($account->uid) && user_access('access user profiles')) { $attributes = array('attributes' => array('title' => t('View user profile.')), 'html' => TRUE);