Posts Learn Snippets Categories Tags About
/

How to Show Gravatar Image on Laravel 8

Learn how to render and show gravatar image on Laravel 8 to show a picture of your user

Created on Jul 07, 2021

10 views

To render any of the gravatar image from Laravel, you can make use of "creativeorange/gravatar" package. The steps are very simple so let's get started.

1 - Install the Dependency
composer require creativeorange/gravatar ~1.0

2 - Call the Helper Function
To show and render the image, call the Gravatar helper function.
@if (Gravatar::exists('[email protected]'))
    <img src="{{ Gravatar::get('[email protected]') }}" />
@endif

If there is no image found, you can use the fallback and provide a URL to the default image.
Gravatar::fallback('http://example.com/avatar.jpg')->get('[email protected]');

Created by

PostSrc poster

PostSrc

Full stack developer mainly focusing on the front end side of the web. The main author of PostSrc and loves writing tutorial and guides online.