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 Dependencycomposer 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]');
Leave a reply