PHP Classes

PHP Avatar Generator Class: Generate people's avatar images using their names

Recommend this page to a friend!
  Info   View files Example   View files View files (8)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 137 All time: 9,245 This week: 206Up
Version License PHP version Categories
php-avatar 1.0.0MIT/X Consortium ...5PHP 5, Graphics
Description 

Author

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.

Picture of Muhammad Umer Farooq
Name: Muhammad Umer Farooq is available for providing paid consulting. Contact Muhammad Umer Farooq .
Classes: 52 packages by
Country: Pakistan Pakistan
Age: 22
All time rank: 84511 in Pakistan Pakistan
Week rank: 112 Up2 in Pakistan Pakistan Up
Innovation award
Innovation award
Nominee: 6x

Example

<?php
   
use Lablnet\Avatar;
    require
'../vendor/autoload.php';
   
$avatar = new Avatar;
   
//$avatar->getInstance()->setBlock(2); //change block
   
$imageDataUri = $avatar->getImgDataBase64('Denil',128,'','#daf45s');
    echo
"<img src=".$imageDataUri." />";


Details

PHP Avatar

Allow user to generate their avatar based on name and first character will show on avatar.

enter image description hereenter image description here

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

  • PHP
  • Composer

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');


  Files folder image Files  
File Role Description
Files folder imageexample (1 file)
Files folder imagesrc (3 files)
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file readme.md Doc. Documentation

  Files folder image Files  /  example  
File Role Description
  Accessible without login Plain text file index.php Example Example script

  Files folder image Files  /  src  
File Role Description
  Plain text file ABase.php Class Class source
  Plain text file AGd.php Class Class source
  Plain text file Avatar.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:137
This week:0
All time:9,245
This week:206Up