📜 ⬆️ ⬇️

Gravatar'ki


Most wordpress'ovtsev probably know what Gravatar. This is a service that allows users to shine their avatar when commenting on any of the thousands of sites that support Gravatar, without registration or login.

How it works?


The user is registered on the Gravatar service and loads avatars.

... it takes some time ...
')
A user comes to a blog and leaves a comment there. Of course, along with the comment in 90% of cases, he leaves his email.

When displaying a comment, the blog asks gravatar.com for the user's avatar for his soap. If the avatar exists, it is displayed. If it does not exist, the standard picture is displayed.

For those familiar with Gravatar, all this, of course, is not news. However, there is news - at the bottom.



I want this! Where to begin?


Registration for gravatar is extremely simple.

1. Go to http://www.gravatar.com
2. Click the link “sign up” (above). We get:

3. Enter your email, and receive in a moment an email confirming and activating your Gravatar account.
4. Follow the instructions in the letter and activate the account.

5. After activation, you need to assign your email addresses and avatars (yes, there may be several!)

6. Avatars can be loaded from disk or specify a URL.
7. After adding, you can stretch or crop the pattern as you like.


8. After that, you will be offered to choose the rating of this avatar. Let me explain what it is in free translation:

G - on the avatar there is nothing obscene, it can be used on all public sites.
PG - on the avatar can be indecent gestures, or something provocative
R - avatar contains elements of cruelty, naked bodies or pictures of taking hard drugs
X - on the avatar depicts scenes of a pornographic nature.

So, choose your category, click on the desired button.

9. And the last - in fact, bind the avatar to the email address.


You can add as many avatars and emails as you like, but this is a matter of taste.

For site owners



Gravatar can be embedded in any stand-alone blog (especially for drupal ).

Right, using it is simple as a bagel. Here, for example, implementation on PHP:
$email = "someone©somewhere.com";
$default = "http://www.somewhere.com/homestar.jpg";
$size = 40; //1, 16, 77 ... 512

$gravatar_uri = 'http://www.gravatar.com/avatar.php?'.
'gravatar_id='.md5($email).
'&default='.urlencode($default).
'&size='.$size;

print('');


And now - a bonus



Gravatar recently created a beautiful feature . Its essence is that for users who are not registered in Gravatar, instead of one standard image (default = http ...), the generated one is shown.


As you can see, this greatly enlivens the appearance of the discussion thread. Supported image variations:
1. identicon

2. wavatar

3. monsterid


In order to implant them into your code, you need to write not default = http ... , but, for example, default = monsterid

That's all for today. I tried to open the topic completely. On the success of judging you.

Source: https://habr.com/ru/post/25608/


All Articles