empowercreative/empoweravatar

Fetch an avatar image when viewing e-mail (using Gravatar, Libravatar, Evatar and/or custom template).

Installs: 41

Dependents: 0

Suggesters: 0

Stars: 0

Watchers: 1

Forks: 1

Open Issues: 1

Type: roundcube-plugin

dev-master 2019-04-04 09:00 UTC

README

Non official plug-in showing Gravatar, Libravatar and Evatar profile images inside the Roundcube webmail client. It also contains a custom avatars API.

This is based on Pau Rodriguez's gravatar plugin and as such, replaces it.

It has been implemented as a Roundcube readonly hidden addressbook. You have to ensure this plugin is added into the latest entry in the main config ($config['plugins']).

  • If any address book (LDAP, Google, etc...) already has an image for a contact, it will use that image first.
  • If none is found, then it will use Empower Avatar.

Tested in Roundcube 1.4.0.

Installation

Intallation steps:

  • Via composer:
    • Run php composer.phar require "empowercreative/empoweravatar":"master"
  • Via git:
    • Clone the repository: cd roundcube/plugins && git clone https://github.com/empower-creative-studios/empoweravatar.git empoweravatar
  • Via tarball:
    • Download and extract the tarball into roundcube/plugins directory and rename the extracted directory to empoweravatar

For the expected behaviour ensure it is always the last plugin (or at least addressbook plugin) in the $config['plugins'] list at config/config.inc.php.

To enable per user: Login to Roundcube and enable/disable plugin:

  • Navigate to the Settings page
  • Click on Preferences
  • Click on Contacts
  • Enable Empower Avatar
  • Save

To configure/change default values:

  • Copy config.inc.php.dist to config.inc.php in the plugins/empoweravatar/ directory.
  • Modify the values you are interested in changing and comment the rest with '//'

Custom API

Enable by setting 'empoweravatar_custom_enabled' in config.inc.php in plugins/empoweravatar/ directory to true.

You can define your custom API for photos at 'empoweravatar_custom_template' in config.inc.php in plugins/empoweravatar/ directory with the following substitutions.

  • %%: literal '%'
  • %s: schema ('http', 'https') depending of 'gravatar_https' config
  • %e: contact email (escaped with urlencode)
  • %m: hashed md5(email)
  • %a: hashed sha1(email)
  • %z: configured avatar size (in px)
  • %r: configured rating ('g', 'pg', 'r', 'x')

Usage for default Gravatar API is: %s://www.gravatar.com/avatar/%m?s=%z&r=%r&d=404

If you have any other large avatar providers that we haven't used, please notify us. We are always happy to add more.

You can use local files, it does not need to be a URL. But if you plan to use it for direct filesystem access, for security reasons it is best to only use hashed email substitutions, even though all parameters are escaped with urlencode.

Examples:

$config['empoweravatar_custom_template'] = 'https://www.example.com/directory/%e.jpg?s=%z';
//OR//
$config['empoweravatar_custom_template'] = '/path/%m.jpg';

License

FOSSA Status