PHP code example of gleez / gravatar

1. Go to this page and download the library: Download gleez/gravatar 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/ */

    

gleez / gravatar example snippets


// Some preparation with your class autoloader
// ...

// Get Gravatar instance
$gravatar = Gleez\Gravatar\Gravatar::getInstance();

// Setting default image, maximum size and maximum allowed Gravatar rating
$gravatar->setDefaultImage('retro')
         ->setSize(220)
         ->setRating('pg');

// Build the Gravatar URL based on the configuration and provided email address
$avatar = $gravatar->buildURL('[email protected]');


// Set gravatars size 64x64px
$gravatar->setSize(64);

// Set gravatars size 100x100px
$gravatar->setSize('100');

// boolean false for the gravatar default
$gravatar->setDefaultImage(false);

// string specifying a recognized gravatar "default"
$gravatar->setDefaultImage('identicon');

// string with image URL
$gravatar->setDefaultImage("http://example.com/your-default-image.png");

// Enable secure connections:
$gravatar->enableSecureURL();

// Disable secure connections:
$gravatar->disableSecureURL();

$gravatar->setRating('PG');

// Enable
$gravatar->enableForceDefault();

// Disable
$gravatar->disableForceDefault();
bash
$ curl -sS https://getcomposer.org/installer | php
bash
$ php composer.phar install