From 849a10fbbab9abb2858bd5c2e080f926adb063db Mon Sep 17 00:00:00 2001
From: Steven Wittens <steven@10.no-reply.drupal.org>
Date: Thu, 24 Aug 2006 00:04:44 +0000
Subject: [PATCH] Allow absolute urls for theme('image'), needed for user
 pictures to work properly.

---
 includes/theme.inc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/includes/theme.inc b/includes/theme.inc
index 124f187d7db9..69c6957c6e07 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -534,7 +534,7 @@ function theme_links($links, $delimiter = ' | ') {
  * Return a themed image.
  *
  * @param $path
- *   The path of the image file.
+ *   Either the path of the image file (relative to base_path()) or a full URL.
  * @param $alt
  *   The alternative text for text-based browsers.
  * @param $title
@@ -549,7 +549,8 @@ function theme_links($links, $delimiter = ' | ') {
 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);
-    return '<img src="'. check_url(base_path() . $path) .'" alt="'. check_plain($alt) .'" title="'. check_plain($title) .'" '. $image_attributes . $attributes .' />';
+    $url = (url($path) == $path) ? $path : (base_path() . $path);
+    return '<img src="'. check_url($url) .'" alt="'. check_plain($alt) .'" title="'. check_plain($title) .'" '. $image_attributes . $attributes .' />';
   }
 }
 
-- 
GitLab