Skip to content
This repository has been archived by the owner on Mar 22, 2021. It is now read-only.

SampicBE/laravel-adorable-avatars

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Latest Stable Version Total Downloads

Installation

Update your composer.json file to include this package as a dependency

"sampic/laravel-adorableavatars": "~1.0"

This package supports the package discovery functionality provided in Laravel 5.5, so registering the classes as described below is no longer necessary if you use Laravel 5.5.

Register the Adorable Avatars service provider by adding it to the providers array in the config/app.php file.

Sampic\LaravelAdorableAvatars\LaravelAdorableAvatarsServiceProvider::class

Alias the Adorable Avatars facade by adding it to the aliases array in the config/app.php file.

'aliases' => [
     'AdorableAvatars' => Sampic\LaravelAdorableAvatars\Facades\AdorableAvatars::class
]

Configuration (optionnal !)

Update the config file to specify this size by default.

php artisan vendor:publish --provider="Sampic\LaravelAdorableAvatars\LaravelAdorableAvatarsServiceProvider"

Default configuration :

  • (boolean) hash_string (default: true): Hide the content that allows you to generate your avatar
  • (boolean) secure_url (default: true): allows to use the API in https
  • (integer) size: (default: 80) the default size of the generated avatar

Usage

AdorableAvatars::src(string string, int $size = null)

Returns the URL of the image that has been generated thanks to the character string Can optionally pass in the size required as an integer. The size will be contained within a range between 1 - 512 as avatar will no return sizes greater than 512 of less than 1

<!-- Show image with default dimensions -->
<img src="{{ AdorableAvatars::src('helloworld') }}">

<!-- Show image at 200px -->
<img src="{{ AdorableAvatars::src('helloworld', 200) }}">