Beispiel #1
0
 /**
  */
 public function avatarImg($email)
 {
     if (class_exists('Horde_Service_Gravatar')) {
         $gravatar = new Horde_Service_Gravatar(Horde_Service_Gravatar::STANDARD, $GLOBALS['injector']->getInstance('Horde_Http_Client'));
         $data = $gravatar->fetchAvatar($email, array('default' => 404, 'size' => 80));
         if (!is_null($data)) {
             rewind($data);
             $img_data = stream_get_contents($data);
             if (strlen($img_data)) {
                 return array('desc' => '', 'url' => Horde_Url_Data::create('image/jpeg', $img_data));
             }
         }
     }
     return null;
 }
Beispiel #2
0
<?php

require_once 'Horde/Autoloader/Default.php';
$g = new Horde_Service_Gravatar();
print Horde_Yaml::dump($g->getProfile('*****@*****.**'));
Beispiel #3
0
 public function testFlexibleBase()
 {
     $g = new Horde_Service_Gravatar(Horde_Service_Gravatar::SECURE);
     $this->assertEquals('https://secure.gravatar.com/0c17bf66e649070167701d2d3cd71711', $g->getProfileUrl(' Test@Example.orG '));
 }
Beispiel #4
0
 public function testGetProfile()
 {
     $g = new Horde_Service_Gravatar($this->_server);
     $profile = $g->getProfile('*****@*****.**');
     $this->assertEquals('http://gravatar.com/abc1xyz2', $profile['entry'][0]['profileUrl']);
 }
Beispiel #5
0
<?php

require_once 'Horde/Autoloader/Default.php';
$g = new Horde_Service_Gravatar();
file_put_contents('/tmp/avatar.jpg', $g->fetchAvatar('*****@*****.**'));
Beispiel #6
0
<?php

require_once 'Horde/Autoloader/Default.php';
$g = new Horde_Service_Gravatar();
print $g->fetchProfile('*****@*****.**');