Adds gravatar support to CraftCMS twig templates.
This project is a fork of public archive noxify/craft-gravatar, which has been updated to be compatible with Craft4 and was created due to the "public archive" status of the forked repo.
This plugin requires PHP8 & Craft CMS 4.0.0 or later.
Install via the CraftCMS Plugin Store
Or on the command line (from the project root directory):
composer require belniakmedia/craft-gravatar
php craft plugin/install
The plugins allows you to configure the following settings:
Directly from your CP:
- Gravatar URL (
default: //gravatar.com/avatar/
)- Size (
default: 80
)- Rating (
default: mp
)- Default Avatar (
default: mp
)
Via project config file:
See
config.php
in the plugin root folder for more information.
Detailed instructions what are the allowed values are defined here: https://de.gravatar.com/site/implement/images/
{{ craft.gravatar.url( 'hello@example.com' ) }}
{{ craft.gravatar.url( 'hello@example.com', {'s' : 120, 'd': 'identicon', 'r' : 'x'} ) }}
{{ craft.gravatar.img( 'hello@example.com' ) }}
{{ craft.gravatar.img( 'hello@example.com', {'s' : 120, 'd': 'identicon', 'r' : 'x'} ) }}
{{ craft.gravatar.img( 'hello@example.com', {'s': 120}, {'class' : 'useravatar'} ) }}
Brought to you by Belniak Media