X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FAvatar.php;h=5e8b315fe6b419998b3617710d8f01baa8584651;hb=dff43c03e4cdd76419a430f0942e9eacf30e13b7;hp=6248a84d3b48922074b324d0e1438a3506bda5ca;hpb=343cd6f20577c44487eae4e90ec10bfd954980e3;p=quix0rs-gnu-social.git diff --git a/classes/Avatar.php b/classes/Avatar.php index 6248a84d3b..5e8b315fe6 100644 --- a/classes/Avatar.php +++ b/classes/Avatar.php @@ -55,25 +55,49 @@ 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',