Skip to content

User avatar using name initials - customizable, multilingual

Notifications You must be signed in to change notification settings

sivarajd/letter-avatar

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Letter Avatar for PHP

Generate user avatar using name initials letter.

letter-avatar

Based on the package of same name by Yoga Hanggara

Features

  • Data URI image ready (also save as PNG/JPG).
  • Works with several unicode blocks
  • Set saturation and luminosity to get consistent color
  • Customize size, shape: square, circle.
  • Small, fast.

Install

Via Composer

$ composer require sivarajd/letter-avatar

Implementation

<?php

use SivarajD\LetterAvatar\LetterAvatar;

$avatar = new LetterAvatar('Steven Spielberg');

// Square Shape, Size 64px, Saturation 80, Luminosity 50
$avatar = new LetterAvatar('Steven Spielberg', 'square', 64, 80, 50);

// Save Image As PNG/JPEG
$avatar->saveAs('path/to/filename');
$avatar->saveAs('path/to/filename', "image/jpeg");
<img src="<?php echo $avatar ?>" />

About

User avatar using name initials - customizable, multilingual

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%