X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FAvatar.php;h=8d6424e8b2d1f53c5ccec912404ccde6ee7b26d9;hb=b0527801d9c2b84408bbfdf82bbdc5b778f72cfc;hp=6248a84d3b48922074b324d0e1438a3506bda5ca;hpb=bb2cb65c2aa763c8b28c41b9811c6026a11482db;p=quix0rs-gnu-social.git diff --git a/classes/Avatar.php b/classes/Avatar.php index 6248a84d3b..8d6424e8b2 100644 --- a/classes/Avatar.php +++ b/classes/Avatar.php @@ -55,29 +55,53 @@ class Avatar extends Memcached_DataObject static function path($filename) { - return INSTALLDIR . '/avatar/' . $filename; + $dir = common_config('avatar', 'dir'); + + if ($dir[strlen($dir)-1] != '/') { + $dir .= '/'; + } + + return $dir . $filename; } static function url($filename) { - return common_path('avatar/'.$filename); + $path = common_config('avatar', 'path'); + + if ($path[strlen($path)-1] != '/') { + $path .= '/'; + } + + if ($path[0] != '/') { + $path = '/'.$path; + } + + $server = common_config('avatar', 'server'); + + if (empty($server)) { + $server = common_config('site', 'server'); + } + + // XXX: protocol + + return 'http://'.$server.$path.$filename; } function displayUrl() { $server = common_config('avatar', 'server'); if ($server) { - return 'http://'.$server.'/'.$this->filename; + return Avatar::url($this->filename); } else { return $this->url; } } - static function defaultAvatar($size) + static function defaultImage($size) { static $sizenames = array(AVATAR_PROFILE_SIZE => 'profile', AVATAR_STREAM_SIZE => 'stream', AVATAR_MINI_SIZE => 'mini'); - return theme_path('default-avatar-'.$sizenames[$size].'.png'); + return Theme::path('default-avatar-'.$sizenames[$size].'.png'); } }