<?php /** * This file is only used for demo purpose. * * @package Gravatar * @author Ravi Kumar * @version 0.1.0 * @copyright Copyright (c) 2014, Ravi Kumar * @license https://github.com/ravikumar8/Gravatar/blob/master/LICENSE MIT **/ include_once 'vendor/autoload.php'; $email = '*****@*****.**'; $gravatar = new \Gravatar\Gravatar($email); $url = $gravatar->setSize(200)->url(); $profile = $gravatar->profile('xml'); $name = 'Gravatar Image'; $xml = $profile->xpath('//entry/name/formatted'); if (is_array($xml) && isset($xml[0])) { $name = (string) $xml[0]; } $img = $gravatar->img(array('alt' => $name)); ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Gravatar</title> <style> body { font: 1em "Trebuchet MS", sans-serif; } .comments { width: 100%; }
<?php require __DIR__ . '/../vendor/autoload.php'; $gravatar = new Gravatar\Gravatar(array('rating' => 'x')); print $gravatar->getUrl('*****@*****.**') . PHP_EOL;