Gravatar Helper
, (*1)
A helper that can be used to pull profile pictures from the gravatar service for CakePHP 3.x, (*2)
Description
The gravatar helper aims to make it easy to pull user avatars from the gravatar service rather than having to rebuilt the basic connection and link generation for the API every time you want to use it. There are many customizations that can be set including defaults and the avatar size returned., (*3)
Installation
composer require potatopowered/gravatar-helper
Add the helper to the public helpers variable of the controller you need it on or in the AppController
to have it accessible in all controllers., (*4)
public $helpers = [
'Gravatar' => [
'className' => 'GravatarHelper.Gravatar'
]
];
Usage
To use the gravatar helper you simply call the avatar function of the Gravatar helper with the user email as the argument. There are also several options you can set to change defaults like size., (*5)
// the avatar of the user with an email of $email
$this->Gravatar->avatar($email, ['size' => 40]);
Options for Avatar
- size: The width and height of the profile (150 default)
- default: The default gravatar image (mm default) List Here
- class: The css class of the image tag (gravatar default)