Gravatar is a service that provide unique globally avatars. If you don't have avatar image then you can get Gravatar source image from their email if it register on WordPress.com. So if you want to implement in October CMS then it is very easy, just follow the simple documentation.
Features
- Fetch Gravatar image with default size (80px)
- Fetch Gravatar image with a custom size (0px - 512px)
- Fetch Gravatar url with default size (80px)
- Fetch Gravatar url with custom size (0px - 512px)
- Check whether the email exists with the Gravatar
Introduction
This plugin helps you to fetch a Gravatar profile picture with a custom size.
Install
Go to the Updates and Plugins
and search for Abhimanyu.Gravatar
.
Configure
Then open your terminal and issue the following command to setup the configuration file.
php artisan vendor:publish --provider="Thomaswelton\LaravelGravatar\LaravelGravatarServiceProvider"
Then go to config/gravatar.php
to configure the application to your needs. You can configure three options:
- size: Default is set to
80
. It range between 0 - 512 px; - default: Default is set to
identicon
. - maxRating: Default is set to
g
.
You can read more about these settings in your gravatar.php
configuration file itself.
Usage
Use case 1
In twig template
{{ post.user.email|gravatar(100)}}
This will fetch the profile picture associated with post.user.email
having 100x100
size. The output in html will look like
<img src="https://secure.gravatar.com/avatar/5eeaac7227889fcdff32aec58ef6qe2v?s=100&r=g&d=identicon" alt="" height="100" width="100">
Use case 2
In twig template
{{ 'example@octo.com'|gravatar(100) }}
This will also generate a similar output like Use case 1
.
Use case 3
In twig template
{{ post.user.email|gravatar }}
This will by default will fetch the image in 80x80
size.
Use case 4
In twig template
{{ post.user.email|gravatarH }}
or
{{ post.user.email|gravatarH(100) }}
This will fetch only the url from the Gravatar site. This way you can use the url the way you want. The output will look like
https://secure.gravatar.com/avatar/5eeaac7227889fcdff32aec58ef6qe2v?s=100&r=g&d=identicon
Use case 5
You can verify whether the email exists at the Gravatar website by
{{ gravatarE(post.user.email) }}
or
{{ gravatarE('example@octo.com') }}
This will return 1
if the email exists with the Gravatar otherwise an empty string.
-
This plugin has not been reviewed yet.
-
1.0.3 |
Fixed installation instructions Jan 21, 2017 |
---|---|
1.0.2 |
Added new functions Jan 18, 2017 |
1.0.1 |
First version of Gravatar Jan 18, 2017 |