hassanalisalem / laravel-initial-image by anacoder

Laravel package to create default profile image using name of user.
161
0
2
Package Data
Maintainer Username: anacoder
Maintainer Contact: h.salem7788@gmail.com (Hassan Salem)
Package Create Date: 2016-12-13
Package Last Update: 2017-02-17
Language: PHP
License: MIT
Last Refreshed: 2024-11-19 03:17:22
Package Statistics
Total Downloads: 161
Monthly Downloads: 2
Daily Downloads: 0
Total Stars: 0
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

Laravel initial Image

Laravel package to create default profile image using first two letters of a name.

Installation

Install using composer:

composer require hassanalisalem/laravel-initial-image

Edit app/config/app.php and add the providers

'providers' => [
    'hassanalisalem\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());