Helper for retrieving avatars from gravatar.com

package Default
inherited_from \Zend\View\Helper\AbstractHtmlElement

 Methods

Returns an avatar from gravatar's service.

__invoke(string|null $email = "", null|array $options = array(), array $attribs = array()) : \Zend\View\Helper\Gravatar

$options may include the following:

  • 'img_size' int height of img to return
  • 'default_img' string img to return if email address has not found
  • 'rating' string rating parameter for avatar
  • 'secure' bool load from the SSL or Non-SSL location
see
see More information about gravatar's service.

Parameters

$email

stringnull

Email address.

$options

nullarray

Options

$attribs

array

Attributes for image tag (title, alt etc.)

Returns

\Zend\View\Helper\Gravatar

Return valid image tag

__toString() : string

Returns

string

Get attribs of image

getAttribs() : array

Warning! If you set src attrib, you get it, but this value will be overwritten in protected method setSrcAttribForImg(). And finally your get other src value!

Returns

array

Get the tag closing bracket

getClosingBracket() : string
Inherited

Returns

string

Get default img

getDefaultImg() : string

Returns

string

Get email address

getEmail() : string

Returns

string

Get img size

getImgSize() : integer

Returns

integerThe img size

Return valid image tag

getImgTag() : string

Returns

string

Get rating value

getRating() : string

Returns

string

Get an SSL or a No-SSL location

getSecure() : boolean

Returns

boolean

Get the view object

getView() : null | \Zend\View\Renderer\RendererInterface
Inherited
inherited_from \Zend\View\Helper\HelperInterface::getView()

Returns

null\Zend\View\Renderer\RendererInterface

Set attribs for image tag

setAttribs(array $attribs) : \Zend\View\Helper\Gravatar

Warning! You shouldn't set src attrib for image tag. This attrib is overwritten in protected method setSrcAttribForImg(). This method(_setSrcAttribForImg) is called in public method getImgTag().

Parameters

$attribs

array

Returns

\Zend\View\Helper\Gravatar

Set default img

setDefaultImg(string $defaultImg) : \Zend\View\Helper\Gravatar

Can be either an absolute URL to an image, or one of the DEFAULT_* constants

link More information about default image.

Parameters

$defaultImg

string

Returns

\Zend\View\Helper\Gravatar

Set email address

setEmail(string $email) : \Zend\View\Helper\Gravatar

Parameters

$email

string

Returns

\Zend\View\Helper\Gravatar

Set img size in pixels

setImgSize(integer $imgSize) : \Zend\View\Helper\Gravatar

Parameters

$imgSize

integer

Size of img must be between 1 and 512

Returns

\Zend\View\Helper\Gravatar

Configure state

setOptions(array $options) : \Zend\View\Helper\Gravatar

Parameters

$options

array

Returns

\Zend\View\Helper\Gravatar

Set rating value

setRating(string $rating) : \Zend\View\Helper\Gravatar

Must be one of the RATING_* constants

link More information about rating.

Parameters

$rating

string

Value for rating. Allowed values are: g, px, r,x

Exceptions

\Zend\View\Exception\DomainException

Returns

\Zend\View\Helper\Gravatar

Load from an SSL or No-SSL location?

setSecure(boolean $flag) : \Zend\View\Helper\Gravatar

Parameters

$flag

boolean

Returns

\Zend\View\Helper\Gravatar

Set the View object

setView(\Zend\View\Renderer\RendererInterface $view) : \Zend\View\Helper\AbstractHelper
Inherited
inherited_from \Zend\View\Helper\HelperInterface::setView()

Parameters

$view

\Zend\View\Renderer\RendererInterface

Returns

\Zend\View\Helper\AbstractHelper

Get avatar url (including size, rating and default image options)

getAvatarUrl() : string

Returns

string

Get URL to gravatar's service.

getGravatarUrl() : string

Returns

stringURL

Converts an associative array to a string of tag attributes.

htmlAttribs(array $attribs) : string
Inherited
access public

Parameters

$attribs

array

From this array, each key-value pair is converted to an attribute name and value.

Returns

stringThe XHTML for the attributes.

Is doctype XHTML?

isXhtml() : boolean
Inherited

Returns

boolean

Normalize an ID

normalizeId(string $value) : string
Inherited

Parameters

$value

string

Returns

string

Set src attrib for image.

setSrcAttribForImg() : void

You shouldn't set an own url value! It sets value, uses protected method getAvatarUrl.

If already exists, it will be overwritten.

 Properties

 

Attributes for HTML image tag

$attribs : array

Default

 

The tag closing bracket

$closingBracket : string

Default

null
 

Email Address

$email : string

Default

 

True or false if the email address passed is already an MD5 hash

$emailIsHashed : boolean

Default

 

Options

$options : array

Default

array('img_size' => 80, 'default_img' => self::DEFAULT_MM, 'rating' => self::RATING_G, 'secure' => null)
 

View object instance

$view : \Zend\View\Renderer\RendererInterface

Default

null

 Constants

 

Default gravatar image value constants

DEFAULT_404 = '404' 
 

DEFAULT_IDENTICON

DEFAULT_IDENTICON = 'identicon' 
 

DEFAULT_MM

DEFAULT_MM = 'mm' 
 

DEFAULT_MONSTERID

DEFAULT_MONSTERID = 'monsterid' 
 

DEFAULT_WAVATAR

DEFAULT_WAVATAR = 'wavatar' 
 

EOL character

EOL = PHP_EOL 
deprecated just use PHP_EOL
 

URL to gravatar service

GRAVATAR_URL = 'http://www.gravatar.com/avatar' 
 

Secure URL to gravatar service

GRAVATAR_URL_SECURE = 'https://secure.gravatar.com/avatar' 
 

Gravatar rating

RATING_G = 'g' 
 

RATING_PG

RATING_PG = 'pg' 
 

RATING_R

RATING_R = 'r' 
 

RATING_X

RATING_X = 'x'