has moved to IP address -- please double check where you are logging in.

Commit 98f064e4 authored by Jean Baptiste Favre's avatar Jean Baptiste Favre

Adds new feature to dispatch avatar url between different servers.

That allows parallel download from most browsers.
To avoid caching issue, server choice is "profile_id" based so that
avatar from a specific user will always be served from same server.

Introduce new configuration parameter:
$config['avatar']['server_modulo'] = 5;

Very easy to implement using, for example, DNS wildcard.
For example, if you have following configuration:
$config['avatar']['server']        = 'static_rrdns_.domain.tld';
$config['avatar']['server_modulo'] = 5;

Then, when building avatar's URL, domain will become, depending on profile_id:
parent afd42611
......@@ -103,7 +103,11 @@ class Avatar extends Memcached_DataObject
$server = common_config('avatar', 'server');
if ($server) {
return Avatar::url($this->filename);
if (common_config('avatar', 'server_modulo') && common_config('avatar', 'server_modulo') > 1 ){
return str_replace( '_rrdns_', ( $this->profile_id % common_config('avatar', 'server_modulo') ), Avatar::url($this->filename) );
return Avatar::url($this->filename);
} else {
return $this->url;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment