Or Weinberger
Or Weinberger

Reputation: 7472

Gravatar email hash function

Let's say my email is [email protected], I am registered with Gravatar.com and I have defined a custom image.

Now, when I try and follow the instructions that appear on gravatar.com and do this:

$gravatar = md5( strtolower( trim( $user->email ) ) );

<img src="http://www.gravatar.com/avatar/<?= $gravatar ?>?s=100" />

I don't get the default gravatar image, so that means there's something wrong with the email address I entered.

But when I remove the strtolower and the trim functions, everything is working perfectly.

Note: $user->email = [email protected] (no trailing spaces or capitals anywhere).

Why is that? also, if I echo $gravatar with the strtolower and trim functions, it looks exactly the same.

Upvotes: 0

Views: 752

Answers (1)

Or Weinberger
Or Weinberger

Reputation: 7472

Not sure what was the problem, it generates the same hash now. didn't before. Maybe I had a misspell somewhere, thanks anyways guys

Upvotes: 1

Related Questions