PHP Class Phalcon\Avatar\Gravatar

This component provides an easy way to retrieve a user's profile image from Gravatar site based on a given email address. If the email address cannot be matched with a Gravatar account, an alternative will be returned based on the Gravatar::$defaultImage setting. Users with gravatars can have a default image if you want to.
Inheritance: implements Phalcon\Avatar\Avatarable
Datei anzeigen Open project: phalcon/incubator Class Usage Examples

Public Methods

Method Description
__construct ( $config )
disableForceDefault ( ) : Gravatar Disable forces default image
disableSecureURL ( ) : Gravatar Disable the use of the secure protocol for image URLs
enableForceDefault ( ) : Gravatar Forces Gravatar to display default image
enableSecureURL ( ) : Gravatar Enable the use of the secure protocol for image URLs
getAvatar ( string $identity ) : string
getDefaultImage ( ) : mixed
getEmailHash ( string $email ) : string Get the email hash to use
getRating ( ) : integer Get the current maximum allowed rating for avatars
getSize ( ) : integer
isUseForceDefault ( ) : boolean Check if need to force the default image to always load
isUseSecureURL ( ) : boolean Check if we are using the secure protocol for the image URLs
setDefaultImage ( mixed $image ) : Gravatar
setRating ( string $rating ) : Gravatar Set the maximum allowed rating for avatars
setSize ( integer $size ) : Gravatar

Protected Methods

Method Description
buildURL ( string $email ) : string Build the Gravatar URL based on the configuration and provided email address

Method Details

__construct() public method

public __construct ( $config )

buildURL() protected method

Build the Gravatar URL based on the configuration and provided email address
protected buildURL ( string $email ) : string
$email string The email to get the gravatar for
return string

disableForceDefault() public method

Disable forces default image
public disableForceDefault ( ) : Gravatar
return Gravatar

disableSecureURL() public method

Disable the use of the secure protocol for image URLs
public disableSecureURL ( ) : Gravatar
return Gravatar

enableForceDefault() public method

Forces Gravatar to display default image
public enableForceDefault ( ) : Gravatar
return Gravatar

enableSecureURL() public method

Enable the use of the secure protocol for image URLs
public enableSecureURL ( ) : Gravatar
return Gravatar

getAvatar() public method

public getAvatar ( string $identity ) : string
$identity string The email to get the gravatar for
return string

getDefaultImage() public method

public getDefaultImage ( ) : mixed
return mixed

getEmailHash() public method

Get the email hash to use
public getEmailHash ( string $email ) : string
$email string The email to get the hash for
return string

getRating() public method

The string representing the current maximum allowed rating ('g', 'pg', 'r', 'x').
public getRating ( ) : integer
return integer

getSize() public method

public getSize ( ) : integer
return integer

isUseForceDefault() public method

Check if need to force the default image to always load
public isUseForceDefault ( ) : boolean
return boolean

isUseSecureURL() public method

Check if we are using the secure protocol for the image URLs
public isUseSecureURL ( ) : boolean
return boolean

setDefaultImage() public method

Possible $image formats: - a string specifying a recognized gravatar "default" - a string containing a valid image URL - boolean false for the gravatar default
public setDefaultImage ( mixed $image ) : Gravatar
$image mixed The default image to use
return Gravatar

setRating() public method

Set the maximum allowed rating for avatars
public setRating ( string $rating ) : Gravatar
$rating string The maximum rating to use for avatars ('g', 'pg', 'r', 'x')
return Gravatar

setSize() public method

By default, images from Gravatar.com will be returned as 80x80px
public setSize ( integer $size ) : Gravatar
$size integer The avatar size to use
return Gravatar