Skip to content
/ laricon Public

Laravel generate awesome and unique identicons with beautiful colors

Notifications You must be signed in to change notification settings

viest/laricon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Identicon generator for Laravel

Laricon is a library which generate an identicon image based on a string.

Here is some examples of awesome results!

Identicon example #1   Identicon example #2   Identicon example #3   Identicon example #4   Identicon example #5

Installation

composer require vikin/laricon

Usage

Images are generated in PNG format with transparent background.

The string can be an email, an IP address, a username, an ID or something else.

Generate an identicon

Add in the config/app.php file

'providers' => [
    ....
    Vikin\Laricon\Providers\LariconServiceProvider::class
],

'aliases' => [
    ....
    'Laricon' => Vikin\Laricon\Facades\Laricon::class
]

Then you can generate and display an identicon image

Laricon::displayImage('vikin');

or generate and get the image data

Laricon::getImageData('vikin');

or generate and get the base 64 image uri ready for integrate into an HTML img tag.

Laricon::getImageDataUri('vikin');
<img src="{{ Laricon::getImageDataUri('vikin') }}" alt="Vikin Identicon" />

Change the size

By default the size will be 64 pixels. If you want to change the image size just add a secondary parameter. 512 x 512px in this example.

Laricon::displayImage('vikin', 512);

Color

The color is automatically generated according to the string hash but you can chose to specify a color by adding a third argument.

Color can be an hexadecimal with 6 characters

Laricon::displayImage('vikin', 64, 'A87EDF');

or an array with red, green, blue value

Laricon::displayImage('foo', 64, [200, 100, 150]);

That's it!

License

Identicon is released under the MIT License. See the bundled LICENSE file for details.

From the yzalis/Identicon

About

Laravel generate awesome and unique identicons with beautiful colors

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages