1. Go to this page and download the library: Download nicolas-gille/gravatar-lib 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/ */
nicolas-gille / gravatar-lib example snippets
// Includes sources or use autoloader to load directly the class.
GravatarLib\Gravatar\Gravatar();
// Set size and rating like this or use it directly on constructor.
$gravatar->setSize(160);
$gravatar->setMaxRating('pg');
// Generate uri to show avatar.
$uri = $gravatar->getUri('[email protected]');
// Display it.
echo '<img src="' . $uri . '" alt="Gravatar\'s image">';
$gravatar->setSize(160);
$gravatar->setDefaultImage('blank'); // with default value.
$gravatar->setDefaultImage('http://my-website/my-avatar.jpg'); // with url.
$gravatar->setDefaultImage(''); // Cannot use default image.
$gravatar->setMaxRating('g');
$gravatar->setSecureUri(true); // Use HTTPS instead of HTTP.
$gravatar->setForceDefaultImage(true); // Force all people to show default image instead of account avatar.
// Includes sources or use autoloader to load directly the class.
new GravatarLib\Gravatar\Gravatar();
// ... do whatever you want with your settings here
// here, we will assume $twig is an already-created instance of Twig_Environment
$twig->addGlobal('gravatar', $gravatar);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.