danyalds / letter-avatar
Letter Avatar compatible with Persian language for PHP
dev-main
2021-01-22 13:23 UTC
This package is not auto-updated.
Last update: 2024-09-29 07:06:21 UTC
README
Letter Avatar compatible with Persian language for PHP
Quick use
require_once "LetterAvatar.php"; header("Content-Type: image/png"); createAvatar("علی محمدی");
Result:
Customization
Change avatar shape
$settings = array("shape"=>"square"); createAvatar("علی محمدی",$settings);
Result:
Change background color
$settings = array("background"=>"#da1327"); createAvatar("علی محمدی",$settings);
Result:
Add first letter of lastname
$settings = array("words"=>"two"); createAvatar("علی محمدی",$settings);
Result:
Other settings
$settings = array("direction"=>"rtl", // "rtl" for RTL languages like Persian, Arabic & "ltr" for other languages [default: "rtl"] "shape"=>"circle", // "circle" & "square" [default: "circle"] "size"=>"180", // avatar size in px [default: 120] "words"=>"two", // "one" for the first letter of firstname & "two" for the first letters of firstname and lastname [default: "one"] "font"=>"vazir.ttf", // location to your ttf font [default: "vazir.ttf"] "fontSize"=>"60", // font size of the text [default: 1/3*(image size) (recommended)] "background"=>"#da1327" // background color of avatar [default: random by user name] );