Giter VIP home page Giter VIP logo

laricon's Introduction

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

laricon's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.