Recommend this page to a friend! |
Classes of Muhammad Umer Farooq | PHP Avatar Generator Class | readme.md | Download |
|
DownloadPHP AvatarAllow user to generate their avatar based on name and first character will show on avatar. DescriptionThis 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
installrun this command
<?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." />";
<?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." />";
<?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');
|