B-Matt / magento2-gravatar

Gravatar implementation for Magetno 2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Magento 2 Gravatar Extension

This extension implements Gravatar service in Magento 2! This module uses customer e-mail for generating Gravatar URL and it is complatible with Magento 2.

Requirements

Magento 2.0+

How to install

Installation is pretty easy just use Composer for it and viola! If you can't install it via Composer just create Matej\Gravatar folders in app folder. Your folder structure should look like:

app/code/
├── Matej/
│   │   ├──Gravatar/
│   │   │   ├── ...
│   │   │   ├── ...

How to use

There is optional Block code that you can use in templates:

echo Matej\Gravatar\Helper\Data::getCustomerAvatarByMail($email);
echo Matej\Gravatar\Helper\Data::getCustomerAvatarById($customer_id);

It automatically create block and put Gravatar URL (use those echo's for images src)!

You can use custom PHP code for creating Gravatar URL based on custom params:

$url = $this
    ->setGravatarSize(80)                           // Optional (default is 80)
    ->setGravatarSecured(false)                     // Optional (default is false)
    ->setGravatarDefaultImage('identico', false)    // Optional (default is mm)
    ->setGravatarRating('g')                        // Optional (default is g)
    ->getGravatarURL('example@example.com');
echo $url;
// Prints out: http://www.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?s=60&r=g&d=mm

That's all!

About

Gravatar implementation for Magetno 2

License:Apache License 2.0


Languages

Language:HTML 59.6%Language:PHP 30.3%Language:CSS 10.1%