jeffersonsimaogoncalves/gravatar-helper

A helper that can be used to pull profile pictures from the gravatar service for CakePHP 3.x

2.1.0 2020-11-09 21:30 UTC

This package is auto-updated.

Last update: 2024-03-30 00:19:19 UTC


README

Software License Travis Codecov Scrutinizer Packagist

A helper that can be used to pull profile pictures from the gravatar service for CakePHP 3.x

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.

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.

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.

// 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)