You are here

public function GravatarGenerator::generateUri in Avatar Kit 8

Creates a URI to an avatar.

Parameters

\Drupal\Core\Session\AccountInterface $account: A user account.

Return value

string URI to an image file.

Overrides AvatarGeneratorBase::generateUri

File

avatars_gravatar/src/Plugin/AvatarGenerator/GravatarGenerator.php, line 39

Class

GravatarGenerator
Gravatar generated avatars generator.

Namespace

Drupal\avatars_gravatar\Plugin\AvatarGenerator

Code

public function generateUri(AccountInterface $account) {
  $gravatar = new GravatarAPI();
  return $gravatar
    ->setIdentifier($this
    ->getIdentifier($account))
    ->setType($this->configuration['type'])
    ->setDimensions(256)
    ->getUrl();
}