| Recommend this page to a friend! | 
| Info | Documentation | Screenshots | Reputation | Support forum | Blog | Links | 
| Ratings | Unique User Downloads | Download Rankings | ||||
| Not enough user ratings | Total: 281 | All time:  7,609 This week: 673 | ||||
| Version | License | PHP version | Categories | |||
| zx-avatar-generator 1.1.2 | BSD License | 7.1 | Graphics, PHP 7 | 
| Description | Author | |
| This class can generate an image for a person with a given name. Innovation Award | 
Generate avatar from given name
I need to generate an avatar with the characters of a given name
Generate avatar for user by his name, file or url.
Install with composer:
composer require zertex/avatar-generator
or add
"zertex/avatar-generator": "*"
to the require section of your composer.json file.
$options = AvatarOptions::create()
			->setFont('path to ttf font')
			->setWidth(300)
			->setFontSize(200)
			->setTexturesFolder('path to textures folder')
			->setImagesFolder('path to generated images folder')
			->setImagesUrl('url to images folder')
			->setSalt('random salt');
Generate avatar image by username
$image_src = Avatar::init('John Smith', $options, [result file name])
			   ->username()
			   ->texture('TEXTURE_NAME')
			   ->text()
			   ->get_file_name();
Generate avatar image from file
$image_src = Avatar::init('John Smith', $options, [result file name])
			   ->file('/path/to/file')
			   ->texture('TEXTURE_NAME')
			   ->text()
			   ->get_file_name();
Generate avatar image from url
$image_src = Avatar::init('John Smith', $options, [result file name])
			   ->file('http://your-site.com/image.jpg')
			   ->texture('TEXTURE_NAME')
			   ->text()
			   ->get_file_name();
You can exclude texture or text from chain for exclude them
You can use PNG texture with transparancy. Every texture must consist of 2 files (back & white). His names myst be:
TEXTURE_NAME . '-' . COLOR . '.png'

Avater generator extension for Yii2 here: https://github.com/zertex/yii2-avatar-generator
https://zertex.ru/yii2-avatar-generator
| Screenshots (1) | ||
| File | Role | Description | ||
|---|---|---|---|---|
| Data | Auxiliary data | |||
| Lic. | License text | |||
| Doc. | Documentation | |||
| / | src | 
| File | Role | Description | 
|---|---|---|
|  | Class | Class source | 
|  | Class | Class source | 
| The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. | 
| zx-avatar-generator-2018-07-09.zip 277KB | |
| zx-avatar-generator-2018-07-09.tar.gz 278KB | |
| Install with Composer | 
| Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
| 83% | 
 | 
 | 
| Applications that use this package | 
![]() If you know an application of this package, send a message to the author to add a link here.
 If you know an application of this package, send a message to the author to add a link here.