Documentation

Horde_Service_Gravatar
in package

Horde_Service_Gravatar abstracts communication with Services supporting the Gravatar API.

Tags
category

Horde

author

Gunnar Wrobel wrobel@pardus.de

license

http://www.horde.org/licenses/lgpl21 LGPL 2.1

link
http://www.gravatar.com/site/implement/

Table of Contents

SECURE  = 'https://secure.gravatar.com'
The Gravatar base URL in SSL context
STANDARD  = 'http://www.gravatar.com'
The default Gravatar base URL
$_base  : string
The base Gravatar URL.
$_client  : Horde_Http_Client
The HTTP client to access the server.
__construct()  : mixed
Constructor.
fetchAvatar()  : resource
Fetch the avatar image.
fetchProfile()  : string
Fetch the Gravatar profile information.
getAvatarUrl()  : 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" />
getId()  : string
Return the Gravatar ID for the specified mail address.
getProfile()  : array<string|int, mixed>
Return the Gravatar profile information as an array.
getProfileUrl()  : string
Return the Gravatar profile URL.

Constants

SECURE

The Gravatar base URL in SSL context

public mixed SECURE = 'https://secure.gravatar.com'

STANDARD

The default Gravatar base URL

public mixed STANDARD = 'http://www.gravatar.com'

Properties

$_base

The base Gravatar URL.

private string $_base

$_client

The HTTP client to access the server.

private Horde_Http_Client $_client

Methods

__construct()

Constructor.

public __construct([string $base = self::STANDARD ][, Horde_Http_Client $client = null ]) : mixed

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
$base : string = self::STANDARD

The base Gravatar URL.

$client : Horde_Http_Client = null

The HTTP client to access the server.

Return values
mixed

fetchAvatar()

Fetch the avatar image.

public fetchAvatar(string $mail[, mixed $opts = array() ]) : resource
Parameters
$mail : string

The mail address.

$opts : mixed = array()

Additional options. See getAvatarUrl().

Return values
resource

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

fetchProfile()

Fetch the Gravatar profile information.

public fetchProfile(string $mail) : string
Parameters
$mail : string

The mail address.

Return values
string

The profile information.

getAvatarUrl()

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

public getAvatarUrl(string $mail[, mixed $opts = array() ]) : Horde_Url
Parameters
$mail : string

The mail address.

$opts : mixed = array()

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.
Return values
Horde_Url

The image URL.

getId()

Return the Gravatar ID for the specified mail address.

public getId(string $mail) : string
Parameters
$mail : string

The mail address.

Return values
string

The Gravatar ID.

getProfile()

Return the Gravatar profile information as an array.

public getProfile(string $mail) : array<string|int, mixed>
Parameters
$mail : string

The mail address.

Return values
array<string|int, mixed>

The profile information.

getProfileUrl()

Return the Gravatar profile URL.

public getProfileUrl(string $mail) : string
Parameters
$mail : string

The mail address.

Return values
string

The profile URL.

Search results