\Horde_Service_Gravatar

Horde_Service_Gravatar abstracts communication with Services supporting the Gravatar API.

Summary

Methods
Properties
Constants
__construct()
getId()
getAvatarUrl()
getProfileUrl()
fetchProfile()
getProfile()
fetchAvatar()
No public properties found
STANDARD
SECURE
No protected methods found
No protected properties found
N/A
No private methods found
$_base
$_client
N/A

Constants

STANDARD

STANDARD

The default Gravatar base URL

SECURE

SECURE

The Gravatar base URL in SSL context

Properties

$_base

$_base : string

The base Gravatar URL.

Type

string

$_client

$_client : \Horde_Http_Client

The HTTP client to access the server.

Type

\Horde_Http_Client

Methods

__construct()

__construct(string  $base = self::STANDARD, \Horde_Http_Client  $client = null) 

Constructor.

The default Gravatar base URL is Horde_Service_Gravatar::STANDARD. If you need URLs in an HTTPS context you should provide the base URL parameter as Horde_Service_Gravatar::SECURE. In case you wish to access another URL offering the Gravatar API you can specify the base URL of this service as $base.

Parameters

string $base

The base Gravatar URL.

\Horde_Http_Client $client

The HTTP client to access the server.

getId()

getId(string  $mail) : string

Return the Gravatar ID for the specified mail address.

Parameters

string $mail

The mail address.

Returns

string —

The Gravatar ID.

getAvatarUrl()

getAvatarUrl(string  $mail, mixed  $opts = array()) : \Horde_Url

Return the Gravatar image URL for the specified mail address. The returned URL can be directly used with an IMG tag e.g.: <img src="http://www.gravatar.com/avatar/hash" />

Parameters

string $mail

The mail address.

mixed $opts

Additional options. If an integer, treated as the 'size' option. If an array, the following options are available:

  - default: (string) Default behavior. Valid values are '404', 'mm',
             'identicon', 'monsterid', 'wavatar', 'retro', 'blank', or
             a URL-encoded URL to use as the default image.
  - rating: (string) Rating. Valid values are 'g', 'pg', 'r', and 'x'.
  - size: (integer) Image size. Valid values are between 1 and 512.

Returns

\Horde_Url —

The image URL.

getProfileUrl()

getProfileUrl(string  $mail) : string

Return the Gravatar profile URL.

Parameters

string $mail

The mail address.

Returns

string —

The profile URL.

fetchProfile()

fetchProfile(string  $mail) : string

Fetch the Gravatar profile information.

Parameters

string $mail

The mail address.

Returns

string —

The profile information.

getProfile()

getProfile(string  $mail) : array

Return the Gravatar profile information as an array.

Parameters

string $mail

The mail address.

Returns

array —

The profile information.

fetchAvatar()

fetchAvatar(string  $mail, mixed  $opts = array()) : resource

Fetch the avatar image.

Parameters

string $mail

The mail address.

mixed $opts

Additional options. See getAvatarUrl().

Returns

resource —

The image as stream resource, or null if the server returned an error.