Skip to content

parsidev/Gravatar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 

Repository files navigation

Laravel Gravatar

Gravatar Package for Laravel 5.6

installation

For install this package Edit your project's composer.json file to require parsidev/gravatar5.0

"require": {
    "parsidev/gravatar": "5.6.x-dev"
},

Now, update Composer:

composer update

Once composer is finished, you need to add the service provider. Open config/app.php, and add a new item to the providers array.

'Parsidev\Gravatar\GravatarServiceProvider',

Next, add a Facade for more convenient usage. In config/app.php add the following line to the aliases array:

'Gravatar'	=> 'Parsidev\Gravatar\Facades\Gravatar',

Publish config files:

php artisan vendor:publish

Usage

Gravatar::exists($email)

Returns a boolean telling if the given $email has got a Gravatar.

Gravatar::saveImage($email, $destination, $size=null, $rating=null)

Download gravatar

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

<!-- Show image with default dimensions -->
<img src="{{ Gravatar::src('[email protected]') }}">

<!-- Show image at 200px -->
<img src="{{ Gravatar::src('[email protected]', 200) }}">

<!-- Show image at 512px scaled in HTML to 1024px -->
<img src="{{ Gravatar::src('[email protected]', 1024) }}" width=1024>
Gravatar::image($email, $alt = null, $attributes = array(), $rating = null)

Returns the HTML for an <img> tag

echo Gravatar::image('[email protected]');

// Show image at 200px
echo Gravatar::image('[email protected]', 'Some picture', array('width' => 200, 'height' => 200));

// Show image at 512px scaled in HTML to 1024px
echo Gravatar::image('[email protected]', 'Some picture', array('width' => 1024, 'height' => 1024));

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages