Helper for retrieving avatars from gravatar.com

package Zend\View
subpackage Helper

 Methods

Returns an avatar from gravatar's service.

__invoke(string | null $email, null | array $options, array $attribs) : \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 \Zend\View\Helper\http://pl.gravatar.com/site/implement/url
see \Zend\View\Helper\http://pl.gravatar.com/site/implement/url

Parameters

$email

stringnull

Email address.

$options

nullarray

Options

$attribs

array

Attributes for image tag (title, alt etc.)

Returns

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

inherited_from \Zend\View\Helper\AbstractHtmlElement::getClosingBracket()

Returns

string

Get default img

getDefaultImg() : string

Returns

string

Get email address

getEmail() : string

Returns

string

Get img size

getImgSize() : int

Returns

intThe 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() : bool

Returns

bool

Get the view object

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

inherited_from \Zend\View\Helper\AbstractHelper::getView()
inherited_from \Zend\View\Helper\AbstractHtmlElement::getView()

Returns

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

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

Set email address

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

Parameters

$email

string

Returns

Set img size in pixels

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

Parameters

$imgSize

int

Size of img must be between 1 and 512

Returns

Configure state

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

Parameters

$options

array

Returns

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

Load from an SSL or No-SSL location?

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

Parameters

$flag

bool

Returns

Set the View object

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

inherited_from \Zend\View\Helper\AbstractHelper::setView()
inherited_from \Zend\View\Helper\AbstractHtmlElement::setView()

Parameters

Returns

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
inherited_from \Zend\View\Helper\AbstractHtmlElement::htmlAttribs()

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() : bool
Inherited

inherited_from \Zend\View\Helper\AbstractHtmlElement::isXhtml()

Returns

bool

Normalize an ID

normalizeId(string $value) : string
Inherited

inherited_from \Zend\View\Helper\AbstractHtmlElement::normalizeId()

Parameters

$value

string

Returns

string

Set src attrib for image.

setSrcAttribForImg() : void

You shouldn't set a 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

 

The tag closing bracket

$closingBracket : string
Inherited

inherited_from \Zend\View\Helper\AbstractHtmlElement::$$closingBracket
 

Email Address

$email : string

 

Options

$options : array

 

View object

$view : \Zend\View\Renderer\RendererInterface
Inherited

inherited_from \Zend\View\Helper\AbstractHelper::$$view
inherited_from \Zend\View\Helper\AbstractHtmlElement::$$view

 Constants

 

Default gravatar image value constants

DEFAULT_404 

 

DEFAULT_IDENTICON

DEFAULT_IDENTICON 

 

DEFAULT_MM

DEFAULT_MM 

 

DEFAULT_MONSTERID

DEFAULT_MONSTERID 

 

DEFAULT_WAVATAR

DEFAULT_WAVATAR 

 

EOL character

EOL 
Inherited

inherited_from \Zend\View\Helper\AbstractHtmlElement::EOL
 

URL to gravatar service

GRAVATAR_URL 

 

Secure URL to gravatar service

GRAVATAR_URL_SECURE 

 

Gravatar rating

RATING_G 

 

RATING_PG

RATING_PG 

 

RATING_R

RATING_R 

 

RATING_X

RATING_X