diff --git a/actions/showstream.php b/actions/showstream.php index dcb78a4626..d6a460b297 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -114,7 +114,7 @@ class ShowstreamAction extends StreamAction { $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE); common_element_start('div', array('id' => 'profile_avatar')); - common_element('img', array('src' => ($avatar) ? $avatar->url : common_default_avatar(AVATAR_PROFILE_SIZE), + common_element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_PROFILE_SIZE), 'class' => 'avatar profile', 'width' => AVATAR_PROFILE_SIZE, 'height' => AVATAR_PROFILE_SIZE, @@ -227,7 +227,7 @@ class ShowstreamAction extends StreamAction { 'href' => $other->profileurl, 'class' => 'subscription')); $avatar = $other->getAvatar(AVATAR_MINI_SIZE); - common_element('img', array('src' => (($avatar) ? $avatar->url : common_default_avatar(AVATAR_MINI_SIZE)), + common_element('img', array('src' => (($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_MINI_SIZE)), 'width' => AVATAR_MINI_SIZE, 'height' => AVATAR_MINI_SIZE, 'class' => 'avatar mini', diff --git a/lib/gallery.php b/lib/gallery.php index 4bc7baf5d4..f227c93d29 100644 --- a/lib/gallery.php +++ b/lib/gallery.php @@ -100,7 +100,7 @@ class GalleryAction extends Action { $avatar = $other->getAvatar(AVATAR_STREAM_SIZE); common_element('img', array('src' => - (($avatar) ? $avatar->url : + (($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE)), 'width' => AVATAR_STREAM_SIZE, 'height' => AVATAR_STREAM_SIZE, diff --git a/lib/stream.php b/lib/stream.php index b2f57fab3e..a37e4dfa32 100644 --- a/lib/stream.php +++ b/lib/stream.php @@ -60,7 +60,7 @@ class StreamAction extends Action { 'id' => 'notice-' . $notice->id)); $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE); common_element_start('a', array('href' => $profile->profileurl)); - common_element('img', array('src' => ($avatar) ? $avatar->url : common_default_avatar(AVATAR_STREAM_SIZE), + common_element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE), 'class' => 'avatar stream', 'width' => AVATAR_STREAM_SIZE, 'height' => AVATAR_STREAM_SIZE, diff --git a/lib/util.php b/lib/util.php index 7b821e6351..4d1abe51a7 100644 --- a/lib/util.php +++ b/lib/util.php @@ -625,12 +625,16 @@ function common_avatar_path($filename) { } function common_avatar_url($filename) { - $server = common_config('avatar', 'server'); - if ($server) { - return 'http://'.$server.'/'.$filename; - } else { return common_path('avatar/'.$filename); - } +} + +function common_avatar_display_url($avatar) { + $server = common_config('avatar', 'server'); + if ($server) { + return 'http://'.$server.'/'.$avatar->filename; + } else { + return $avatar->url; + } } function common_default_avatar($size) {