PHP Avatar
Allow user to generate their avatar based on name and first character will show on avatar.
Description
This package can generate people's avatar images using their names.
It takes the name of a person and generates an image with a given width and given foreground and background colors that shows the first letter of the person name.
The package can return the image as a data URL that can be used in HTML img tags to display the generated avatar image.
Requirement
install
run this command
## usage
<?php
use Lablnet\Avatar;
require '../vendor/autoload.php';
$avatar = new Avatar;
$imageDataUri = $avatar->getImgDataBase64('Denil',128,'','#daf45s');
//without background color
//$imageDataUri = $avatar->getImgDataBase64('Denil',128,'','');
echo "<img src=".$imageDataUri." />";
## Change Size , color and background
<?php
use Lablnet\Avatar;
require '../vendor/autoload.php';
$avatar= new Avatar;
//string | size | foreground | background
$imageDataUri = $avatar->getImgDataBase64('php',1000,'#fff','#dad');
echo "<img src=".$imageDataUri." />";
### Save the image
<?php
use Lablnet\Avatar;
require '../vendor/autoload.php';
$avatar= new Avatar;
//string | size | foreground | background | Target+file+extension
$avatar->save('Denil',118,'','','../users/profile/profile.png');