Class vitalik74\primer\Avatar

Inheritancevitalik74\primer\Avatar » yii\base\Object

Provide show avatar.

Example use in your view:

<?php
use vitalik74\primer\Avatar;
?>
<div class="site-avatar">
<?= Avatar::avatar('//avatar.jpg', ['width' => 30, 'height' => 80]) ?>
<?= Avatar::avatarSmall('//avatar.jpg', ['width' => 30, 'height' => 80]) ?>
<?= Avatar::avatarParent([
     'parent' => [
         'src' => '//avatar.jpg',
         'options' => [
             'width' => 30,
             'height' => 80,
             'id' => 'parent_avatar']
         ],
     'child' => [
         'src' => '//avatar2.jpg',
         'options' => [
             ['width' => 15, 'height' => 40]
         ]
     ]
 ], 'left') ?>
</div>

See also [[@see]] http://primercss.io/avatars/.

Public Methods

Hide inherited methods

MethodDescriptionDefined By
avatar() Return img Html-code with avatar vitalik74\primer\Avatar
avatarParent() Return img Html-code with avatar and child vitalik74\primer\Avatar
avatarSmall() Return img Html-code with avatar small vitalik74\primer\Avatar

Method Details

avatar() public method

Return img Html-code with avatar

See also http://primercss.io/avatars/#basic-example.

string avatar$src$options = [], $type '' )
$src string

Path to avatar

$options array

Keys-values pair of options use in \yii\helpers\Html::tag()

$type string

Possible values 'avatar-small' or ''

avatarParent() public method

Return img Html-code with avatar and child

See also http://primercss.io/avatars/#parent-child-avatars.

string avatarParent$options$positionChild 'left' )
$options
$positionChild string

Position child. Possible values right or left

avatarSmall() public method

Return img Html-code with avatar small

See also http://primercss.io/avatars/#small-avatars.

string avatarSmall$src$options = [] )
$src string

Path to avatar

$options array

Keys-values pair of options use in \yii\helpers\Html::tag()