eseperio/yii2-avatar

Avatar management module

Installs: 389

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 2

Forks: 3

Open Issues: 1

Type:yii2-extension

1.0.1 2024-04-22 14:41 UTC

This package is auto-updated.

Last update: 2024-10-22 15:39:58 UTC


README

1.0.0

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