Create avatar is the abbreviation name in Laravel

Tram Ho

Hello today, I will show you how to create avatars that are abbreviated as avatars in your Android phone book or Google account.

SETTING

To create avatars by initials we will need to install a package called laravolt / avatar. To install we perform the following:

If you are using Laravel> = 5.2

And if you are using the Laravel version <5.2:

CONFIG

Next we will implement the config according to our own, at this step we need a file to configure:

After running the publish config command, you will have a file to configure in the following path config/laravolt/avatar.php

USE

To display as an image you just need to execute in the view file as follows:

In addition to creating the image as Base64, you can also use other methods to create images such as: toGravatar() or toSvg() Then come here when running the results, it will look like this:

As I said above we can customize the avatar.php config file as we like, now I will try to reconfigure the image to be a square with a radius boder okay, in the avatar.php file I will edit again the shape is square and radius is 3 :

After saving you do not forget to run

Results after config:

CONCLUDE

Above is a tutorial on how we can create avatars are letters in the name of the name is also very simple, isn’t it.

REFER

https://github.com/laravolt/avatar

Share the news now

Source : Viblo