add a display url function to display URLs

darcs-hash:20080703170347-84dde-1ba2e178dd4051aa63e4073e472c73240e3d9fe8.gz
This commit is contained in:
Evan Prodromou 2008-07-03 13:03:47 -04:00
parent 121b7e60b4
commit 7816e4122a
4 changed files with 13 additions and 9 deletions

View File

@ -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',

View File

@ -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,

View File

@ -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,

View File

@ -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) {