Laravel 5 – load gravatar image using thomaswelton/laravel-gravatar package

Laravel 5 – load gravatar image using thomaswelton/laravel-gravatar package

In this post we will give you information about Laravel 5 – load gravatar image using thomaswelton/laravel-gravatar package. Hear we will give you detail about Laravel 5 – load gravatar image using thomaswelton/laravel-gravatar packageAnd how to use it also give you demo for it if it is necessary.

It’s very easy to setup Gravatars on your site but before going with steps, you should know what is actually meaning of Gravatars, An avatar is a graphical representation of a user.

This service was actually created by Tom Preston-Werner to provide globally unique avatars, It could be the person’s picture or random icon associated with registered emails.

There are several packages available to get Gravatar images but for this example I am going to use thomaswelton/laravel-gravatar package for Laravel application.


Package Installation

First, You will require this package in your application via composer by running following command :

 composer require thomaswelton/laravel-gravatar

Now register the service provider and its aliase in the config/app.php

'providers' => [
	....
	ThomasweltonLaravelGravatarLaravelGravatarServiceProvider::class,
],

'aliases' => [
	....
	'Gravatar' => ThomasweltonLaravelGravatarFacadesGravatar::class
],

Now you are ready to use it in your application by following way :

Gravatar::exists($email) will return boolean to let you know if the $email is associated with Gravatar.

Gravatar::src($email, $size = null, $rating = null) will return the complete URL for the Gravatar registered witl email address.

<!-- Show image with default dimensions -->
<img src="{{ Gravatar::src('thomaswelton@me.com') }}">
<!-- Show image at 200px -->
<img src="{{ Gravatar::src('thomaswelton@me.com', 200) }}">

Try this..

Hope this code and post will helped you for implement Laravel 5 – load gravatar image using thomaswelton/laravel-gravatar package. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Leave a Comment

Your email address will not be published. Required fields are marked *

6  +  1  =  

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US