PHP Classes

File: readme.md

Recommend this page to a friend!
  Classes of Muhammad Umer Farooq   PHP Avatar Generator Class   readme.md   Download  
File: readme.md
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: PHP Avatar Generator Class
Generate people's avatar images using their names
Author: By
Last change: Update readme.md
Date: 5 years ago
Size: 1,551 bytes
 

Contents

Class file image Download

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