2017 © Pedro Peláez
 

library laravel-gravatar

Laravel 5 Gravatar helper

image

thomaswelton/laravel-gravatar

Laravel 5 Gravatar helper

  • Tuesday, September 19, 2017
  • by thomaswelton
  • Repository
  • 12 Watchers
  • 236 Stars
  • 275,966 Installations
  • PHP
  • 20 Dependents
  • 0 Suggesters
  • 37 Forks
  • 4 Open issues
  • 9 Versions
  • 11 % Grown

The README.md

Build Status Latest Stable Version Total Downloads Bitdeli Badge, (*1)

Installation

Update your composer.json file to include this package as a dependency, (*2)

"thomaswelton/laravel-gravatar": "~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., (*3)

Register the Gravatar service provider by adding it to the providers array in the config/app.php file., (*4)

Thomaswelton\LaravelGravatar\LaravelGravatarServiceProvider::class

Alias the Gravatar facade by adding it to the aliases array in the config/app.php file., (*5)

'aliases' => [
     'Gravatar' => Thomaswelton\LaravelGravatar\Facades\Gravatar::class
]

Configuration - Optional

Copy the config file into your project by running, (*6)

php artisan vendor:publish --provider="Thomaswelton\LaravelGravatar\LaravelGravatarServiceProvider"

Default Image

Update the config file to specify the default avatar size to use and a default image to be return if no Gravatar is found., (*7)

Allowed defaults: - (string) <custom URL>: the URL to an image of your choice (publicly available, with an image extension and without a query string). - (string) 404: do not load any image if none is associated with the email hash, instead return an HTTP 404. - (string) mm: (mystery-man) a simple, cartoon-style silhouetted outline of a person (does not vary by email hash). - (string) identicon: a geometric pattern based on an email hash. - (string) monsterid: a generated 'monster' with different colors, faces, etc. - (string) wavatar: generated faces with differing features and backgrounds. - (string) retro: awesome generated, 8-bit arcade-style pixelated faces., (*8)

Example images can be viewed on the Gravatar website., (*9)

Content Ratings

By default only "G" rated images will be shown. You can change this system wide in the config file by editing 'maxRating' => 'g' allowed values are - g: suitable for display on all websites with any audience type. - pg: may contain rude gestures, provocatively dressed individuals, the lesser swear words, or mild violence. - r: may contain such things as harsh profanity, intense violence, nudity, or hard drug use. - x: may contain hardcore sexual imagery or extremely disturbing violence., (*10)

The content rating can be changed by changing the $rating argument when calling Gravatar::src or Gravatar::image., (*11)

Usage

Gravatar::exists($email)

Returns a boolean telling if the given $email has got a Gravatar., (*12)

Gravatar::src($email, $size = null, $rating = null)

Returns the https URL for the Gravatar of the email address specified. Can optionally pass in the size required as an integer. The size will be contained within a range between 1 - 512 as gravatar will no return sizes greater than 512 of less than 1, (*13)


<img src="{{ Gravatar::src('thomaswelton@me.com') }}">


<img src="{{ Gravatar::src('thomaswelton@me.com', 200) }}">


<img src="{{ Gravatar::src('thomaswelton@me.com', 1024) }}" width=1024>

Gravatar::image($email, $alt = null, $attributes = [], $rating = null)

Returns the HTML for an <img> tag, (*14)

// Show image with default dimensions
echo Gravatar::image('thomaswelton@me.com');

// Show image at 200px
echo Gravatar::image('thomaswelton@me.com', 'Some picture', ['width' => 200, 'height' => 200]);

// Show image at 512px scaled in HTML to 1024px
echo Gravatar::image('thomaswelton@me.com', 'Some picture', ['width' => 1024, 'height' => 1024]);

The Versions

19/09 2017

dev-master

9999999-dev https://github.com/thomaswelton/laravel-gravatar

Laravel 5 Gravatar helper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar thomaswelton

laravel laravel5 gravatar

19/09 2017

1.1.3

1.1.3.0 https://github.com/thomaswelton/laravel-gravatar

Laravel 5 Gravatar helper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar thomaswelton

laravel laravel5 gravatar

25/01 2017

1.1.2

1.1.2.0 https://github.com/thomaswelton/laravel-gravatar

Laravel 5 Gravatar helper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar thomaswelton

laravel laravel5 gravatar

19/12 2015

1.1.1

1.1.1.0 https://github.com/thomaswelton/laravel-gravatar

Laravel 5 Gravatar helper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar thomaswelton

laravel laravel5 gravatar

13/10 2015

1.1.0

1.1.0.0 https://github.com/thomaswelton/laravel-gravatar

Laravel 5 Gravatar helper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar thomaswelton

laravel laravel5 gravatar

14/05 2015

1.0.0

1.0.0.0 https://github.com/thomaswelton/laravel-gravatar

Laravel 5 Gravatar helper

  Sources   Download

MIT

The Requires

 

by Avatar thomaswelton

laravel laravel5 gravatar

21/07 2014

0.1.0

0.1.0.0 https://github.com/thomaswelton/laravel-gravatar

Laravel 4 Gravatar helper

  Sources   Download

MIT

The Requires

 

by Avatar thomaswelton

laravel laravel4 gravatar

02/03 2014

0.0.2

0.0.2.0 https://github.com/thomaswelton/laravel-gravatar

Laravel 4 Gravatar helper

  Sources   Download

MIT

The Requires

 

laravel laravel4 gravatar

03/11 2013

0.0.1

0.0.1.0 https://github.com/thomaswelton/laravel-gravatar

Laravel 4 Gravatar helper

  Sources   Download

The Requires

 

laravel laravel4 gravatar