PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Andre Roque Filipe  >  oGravatar  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: oGravatar
Get avatar images and the profile of Gravatar user
Author: By
Last change:
Date: 1 year ago
Size: 1,390 bytes
 

Contents

Class file image Download
<?php

/**
 * oGravatar example file
 *
 * @package oGravatar
 * @author AndrĂ© Filipe <andre.r.flip@gmail.com>
 * @link https://github.com/ReiDuKuduro/oGravatar Github Repo
 * @license MIT
 * @version 1.0
 */

require_once 'oGravatar.php';

$my_gravatar = new oGravatar('andre.r.flip@gmail.com');

$my_gravatar->setSize(200);

$my_gravatar->setRating(oGravatar::RATING_X);

$my_gravatar->setDefault(oGravatar::DEFAULT_MONSTERID);

$attributes = array(
   
'id' => 'my_gravatar_image',
   
'class' => 'some_random_class or-not',
   
'style' => 'height: 200px',
   
'width' => '200px',
);
echo
$my_gravatar->getAvatar($attributes);

echo
'<br>';

echo
$my_gravatar->getAvatarUrl();

echo
'<br>';

$my_gravatar->getProfile();

if (
$my_gravatar->has_profile) {
    echo
'<pre>';
   
print_r($my_gravatar);
    echo
'</pre>';
} else {
    echo
"This email doesn't have a gravatar account";
}

/*

//Chaining stuff
$my_gravatar = new oGravatar('andre.r.flip@gmail.com', true);

$attributes = array(
    'id' => 'my_gravatar_image',
    'class' => 'some_random_class or-not',
    'style' => 'height: 200px',
    'width' => '200px',
);

echo $my_gravatar->setSize(200)
                 ->setRating(oGravatar::RATING_X)
                 ->setDefault(oGravatar::DEFAULT_MONSTERID)
                 ->getAvatar($attributes);
//*/