a6digital / laravel-default-profile-image
Laravel package to create default profile image using name of user.
Installs: 208 163
Dependents: 0
Suggesters: 0
Security: 0
Stars: 40
Watchers: 9
Forks: 6
Type:laravel-library
Requires
- php: >=5.4.0
- intervention/image: 2.*
README
Laravel package to create default profile image using name of user.
Installation
Install using composer:
composer require a6digital/laravel-default-profile-image
Edit app/config/app.php
and add the providers
'providers' => [
'A6digital\Image\DefaultProfileImageServiceProvider'
]
Basic Usage
To create a profile image just do
$img = \DefaultProfileImage::create("Name Surname");
\Storage::put("profile.png", $img->encode());
This will create a profile image that has 512px width&height using the first letters of name and surname.
Advanced Usage
Create a white color text over black color background profile image that has 216px width&height.
$img = \DefaultProfileImage::create("Name Surname", 256, '#000', '#FFF');
\Storage::put("profile.png", $img->encode());
Using a custom font
$img = \DefaultProfileImage::create("@ Lamoni", 256, "#212121", "#FFF", '/var/www/public/fonts/RobotoDraftRegular.woff');
\Storage::put("profile.png", $img->encode());