PHP code example of diego-brocanelli / image-gravatar-php

1. Go to this page and download the library: Download diego-brocanelli/image-gravatar-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

diego-brocanelli / image-gravatar-php example snippets



composer 




egoBrocanelli\Gravatar\Gravatar;

$email = '[email protected]';
$gravatar = new Gravatar($email);

$url = $gravatar->buildURL(); // return: https://www.gravatar.com/avatar/dfeea822891ef9e6df82ec9f4a74cf8d?s=80&d=mm&r=g





egoBrocanelli\Gravatar\Gravatar;

$email = '[email protected]';
$gravatar = new Gravatar($email);

$image = $gravatar->buildImage(); // return: <img src='https://www.gravatar.com/avatar/dfeea822891ef9e6df82ec9f4a74cf8d?s=80&d=mm&r=g'/>




iegoBrocanelli\Gravatar\Gravatar;

$email = '[email protected]';
$gravatar = new Gravatar($email);

$gravatar->setImageSize(200); // return image 200px



iegoBrocanelli\Gravatar\Gravatar;

$email = '[email protected]';
$gravatar = new Gravatar($email);

$gravatar->setImageSet('wavatar');




egoBrocanelli\Gravatar\Gravatar;

$email = '[email protected]';
$gravatar = new Gravatar($email);

$gravatar->setMaxRating('pg');



iegoBrocanelli\Gravatar\Gravatar;

$email = '[email protected]';
$gravatar = new Gravatar($email);

$gravatar->setImageOptions(array('class' => 'image-gravatar'));

$gravatar->buildImage(); // return: <img src='https://www.gravatar.com/avatar/dfeea822891ef9e6df82ec9f4a74cf8d?s=80&d=mm&r=g' class="image-gravatar"/>