necrox87/yii2-avatar

Avatar management module

1.0.2 2019-01-15 18:15 UTC

This package is auto-updated.

Last update: 2024-11-16 06:51:36 UTC


README

1.0.0 ALPHA

Allows upload of a custom avatar without dependency on any extension rather than yii2. Includes a widget to manage upload by users and management by admins.

The intention of this library is add the ability to upload a profile picture via a simple widget.

It must not be dependent from another user management library.

Usage

Add the module to your configuration like follows:

'modules' => [
    'avatar' => [
    'class' => 'eseperio\avatar\Module',
    'adminPermission' => 'admin',
    ]
]

Now place the included widget where you want to display the avatar.

<?= \eseperio\avatar\widgets\Avatar::widget([
'avatarId' => Yii::$app->user->id
]) ?>
Advanced configuration

Events

There are available some events.

JqueryPlugin

This module includes a custom made jquery plugin to manage the upload process. You can configure it via widget through pluginOptions

There are many events available in the plugin. All events must return a boolean and have access to all the params of the parent function. See code to know more.

Available events in jQuery plugin