Simple class for better getting avatars from service gravatar.com
- PHP 5.3.3 or higher
- nette/nette 2.1.* and 2.2.*
- kappa/filesystem 4.2.*
- kappa/utils 1.0.*
The best way to install Kappa\Utils is using Composer:
$ composer require kappa/gravatar:@dev
and register extension:
extensions:
gravatar: Kappa\Gravatar\DI\GravatarExtension
You can set cache directory for faster displaying avatars
gravatar:
cacheDir: %wwwDir%/gravatar #default
Into presenter or control where you can use this helper add filter (helper)
$template->addFilter('gravatar', array($this->gravatar, 'getAvatar')) // for Nette 2.2
$template->registerHelper('gravatar', array($this->gravatar, 'getAvatar')) // for Nette 2.1
Usages in template:
<img src="$user->getEmail()|gravatar:30">