2017 © Pedro Peláez
 

yii2-extension yii2-avatar-generator

Avatar generator for Yii2 Framework.

image

zertex/yii2-avatar-generator

Avatar generator for Yii2 Framework.

  • Thursday, July 5, 2018
  • by Error202
  • Repository
  • 2 Watchers
  • 4 Stars
  • 32 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 15 Versions
  • 0 % Grown

The README.md

Avatar Generator

Generate avatar for user by his name, file or url for Yii2., (*1)

Latest Stable Version Total Downloads, (*2)

Features

  • Generate avatar by username
  • Generate avatar from file or url (http only)
  • Auto select background color by username
  • Contrast color for text
  • Font face and size customize
  • Texture for background (2 available now)

Dependencies

  • PHP 7
  • PHP GD
  • zertex/avatar-generator

Installation

Install with composer:, (*3)

composer require zertex/yii2-avatar-generator

or add, (*4)

"zertex/yii2-avatar-generator": "*"

to the require section of your composer.json file., (*5)

Configuration

Add to common/config/main.php or config/web.php, (*6)

'components' => [
    ...
    'avatar' => [
        'class' => \zertex\avatar_generator\AvatarGenerator::class,
        'images_folder' => 'path_to_image_files',
        'images_url' => 'url_to_image_files',
        'size_width' => 300,            // default: 300
        'font' => 'path_to_ttf_font',   // default: Play-Bold // may use aliases
        'font_size' => 200,             // default: 200
        'salt' => 'random_salt',        // salt for image file names
        'texture' => ['sun', 'rain'],   // texture name
        'text_over_image' => true,      // draw text over image (for avatar from file)
        'texture_over_image' => true,   // draw texture over image (for avatar from file)
    ],
],
  • images_folder - required Folder for images
  • images_url - required Url to folder with images
  • size_width - Origin image side width. Default: 300
  • font - Path to TTF font file. Yii2 aliases ready. Default: Play-Bold.ttf
  • font_size - Font size. Default: 300
  • salt - Random garbage for images file name
  • texture - Texture name: sun, rain. Default: empty
  • text_over_image - Draw text over image. For avatar created from file. Default: true
  • texture_over_image - Draw texture over image. For avatar created from file. Default: true

Using

Yii::$app->avatar->show('username', [width], [file or url], [new_file_name]);

Simple use with default image resolution, (*7)

<?= Yii::$app->avatar->show('John Smith') ?>

Image with 150 px sides, (*8)

<?= Yii::$app->avatar->show('John Smith', 150) ?>

Image for existing file with default image resolution, (*9)

<?= Yii::$app->avatar->show('John Smith', null, '/path/JM_Avatar.jpg') ?>

or, (*10)

<?= Yii::$app->avatar->show('John Smith', null, 'http://site.org/JM_Avatar.jpg') ?>

Image for existing file with 150 px sides, (*11)

<?= Yii::$app->avatar->show('John Smith', 150, '/path/JM_Avatar.jpg') ?>

Using without Yii2 wrap

You can use avatar generator without Yii2 wrap. Just install https://github.com/zertex/avatar-generator, (*12)

Screenshot

alt text, (*13)

Examples

https://zertex.ru/yii2-avatar-generator, (*14)

The Versions

05/07 2018

dev-master

9999999-dev

Avatar generator for Yii2 Framework.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

yii2 yii 2 avatar userpic avatar-generator

05/07 2018

1.1.6

1.1.6.0

Avatar generator for Yii2 Framework.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

yii2 yii 2 avatar userpic avatar-generator

05/07 2018

1.1.5

1.1.5.0

Avatar generator for Yii2 Framework.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

yii2 yii 2 avatar userpic avatar-generator

05/07 2018

1.1.4

1.1.4.0

Avatar generator for Yii2 Framework.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

yii2 yii 2 avatar userpic avatar-generator

05/07 2018

1.1.3

1.1.3.0

Avatar generator for Yii2 Framework.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

yii2 yii 2 avatar userpic avatar-generator

05/07 2018

1.1.2

1.1.2.0

Avatar generator for Yii2 Framework.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

yii2 yii 2 avatar userpic avatar-generator

28/06 2018

1.1.1

1.1.1.0

Avatar generator for Yii2 Framework.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

yii2 yii 2 avatar userpic avatar-generator

27/06 2018

1.1.0

1.1.0.0

Avatar generator for Yii2 Framework.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

yii2 yii 2 avatar userpic

27/06 2018

1.0.6

1.0.6.0

Avatar generator for Yii2 Framework.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

yii2 yii 2 avatar userpic

26/06 2018

1.0.5

1.0.5.0

Avatar generator for Yii2 Framework.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

yii2 yii 2 avatar userpic

26/06 2018

1.0.4

1.0.4.0

Avatar generator for Yii2 Framework.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

yii2 yii 2 avatar userpic

26/06 2018

1.0.3

1.0.3.0

Avatar generator for Yii2 Framework.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

yii2 yii 2 avatar userpic

26/06 2018

1.0.2

1.0.2.0

Avatar generator for Yii2 Framework.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

yii2 yii 2 avatar userpic

26/06 2018

1.0.1

1.0.1.0

Avatar generator for Yii2 Framework.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

yii2 yii 2 avatar userpic

26/06 2018

1.0.0

1.0.0.0

User management for Yii2 Framework.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

yii2 yii 2 avatar userpic