PHP code example of vinicius73 / laravel-instantavatar
1. Go to this page and download the library: Download vinicius73/laravel-instantavatar library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
vinicius73 / laravel-instantavatar example snippets
/**
* Creates the image. Only the first letter will be passed to the image.
* Ex.:
* 'My String' -> output My
* You can change this in the settings
*/
$avatar = IAvatar::random('My String');
/**
* Save imagem in path
* You can use `public::` Omit the full address /public
*/
$avatar->save('public::path/to/file.png');
/**
* Output image in browser
*/
$avatar->display();
return array(
'width' => 150,
'heigth' => 150,
'fontsize' => 80, // in px
'chars' => 2, // Character limit for every image
'font' => array( // You can register or remove more sources with ease.
'InstantAvatar::Comfortaa-Regular.ttf',
'InstantAvatar::Roboto-Regular.ttf',
'InstantAvatar::Ubuntu-Regular.ttf',
'InstantAvatar::DroidSans.ttf'
),
'overlay' => 'InstantAvatar::glass.png', // A watermark that overlays the image
'flat' => false // Enables the flat mode
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.