Class cebe\gravatar\Gravatar
Inheritance | cebe\gravatar\Gravatar » yii\base\Widget |
---|
Displays a gravatar image tag.
To use this widget, you may insert the following code in a view:
echo \cebe\gravatar\Gravatar::widget([
'email' => 'mail@cebe.cc',
'size' => 128,
'defaultImage' => 'monsterid',
// 'secure' => false, // will be autodetected
'rating' => 'r',
'options'=>[
'alt'=>'Gravatar image',
'title'=>'Gravatar image',
]
]);
</pre>
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$defaultImage | string | Default image to use if no gravatar available | cebe\gravatar\Gravatar |
string | The email to use | cebe\gravatar\Gravatar | |
$fileType | string | Can be 'png' or 'jpg' | cebe\gravatar\Gravatar |
$gravatarUrl | cebe\gravatar\Gravatar | ||
$gravatarUrlSecure | cebe\gravatar\Gravatar | ||
$options | array | Html options for the image tag | cebe\gravatar\Gravatar |
$rating | string | Gravatar image rating | cebe\gravatar\Gravatar |
$secure | boolean | Whether to use $gravatarUrl or $gravatarUrlSecure as base url. | cebe\gravatar\Gravatar |
$size | int | Image size in pixel | cebe\gravatar\Gravatar |
Public Methods
Method | Description | Defined By |
---|---|---|
getEmailHash() | Generates email hash for gravatar url | cebe\gravatar\Gravatar |
getImageUrl() | cebe\gravatar\Gravatar | |
run() | cebe\gravatar\Gravatar | |
setEmailHash() | Sets the email hash to use for gravatar url | cebe\gravatar\Gravatar |
Property Details
Default image to use if no gravatar available
The email to use
Can be 'png' or 'jpg'
Html options for the image tag
Gravatar image rating
Whether to use $gravatarUrl or $gravatarUrlSecure as base url. If not set it will be detected by current request.
Image size in pixel
Method Details
Generates email hash for gravatar url
public string getEmailHash ( ) | ||
return | string | Md5 hash of the trimmed lowercase $email |
---|---|---|
throws | \yii\base\InvalidConfigException | if no email has been specified. |
public string getImageUrl ( ) | ||
return | string | Generates the gravatar image url |
---|
public void run ( ) |
Sets the email hash to use for gravatar url
public void setEmailHash ( $hash ) | ||
$hash |