Skip to content
This repository has been archived by the owner on Mar 11, 2022. It is now read-only.

Commit

Permalink
Merge pull request #10 from AntoineAugusti/improve-readme
Browse files Browse the repository at this point in the history
Improve the README content
  • Loading branch information
thomaswelton committed Jul 21, 2014
2 parents 30af9c0 + 13d5381 commit 24b080a
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,43 +32,49 @@ php artisan config:publish thomaswelton/laravel-gravatar

### 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 allowed defaults
- (bool) false
- (string) 404
- (string) mm
- (string) identicon
- (string) monsterid
- (string) wavatar
- (string) retro
Update the config file to specify the default avatar size to use and a default image to be return if no Gravatar is found.

Allowed defaults:
- (bool) `false`
- (string) `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.

Example images can be viewed on [the Gravatar website](https://gravatar.com/site/implement/images/).

### 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
- pg
- r
- x
- `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.

Or the content rating can be changed by changing the `$rating` argument when calling `Gravatar::src` or `Gravatar::image`
The content rating can be changed by changing the `$rating` argument when calling `Gravatar::src` or `Gravatar::image`.


## Usage

### Gravatar::exists($email)
Returns a boolean telling if the given `$email` has got a 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

```html
<!-- Show image with default dimensions -->
<img src="<?= Gravatar::src('thomaswelton@me.com') ?>">
<img src="{{ Gravatar::src('thomaswelton@me.com') }}">

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

<!-- Show image at 512px scaled in HTML to 1024px -->
<img src="<?= Gravatar::src('thomaswelton@me.com', 1024) ?>" width=1024>
<img src="{{ Gravatar::src('thomaswelton@me.com', 1024) }}" width=1024>
```

### Gravatar::image($email, $alt = null, $attributes = array(), $rating = null)
Expand All @@ -84,4 +90,4 @@ echo Gravatar::image('thomaswelton@me.com', 'Some picture', array('width' => 200

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

0 comments on commit 24b080a

Please sign in to comment.