0

I have been trying to get the gravatar to work on my custom made php site.

I have created exactly what was asked on the gravatar website but when implementing it on my site the gravatar just shows there default image.

It obviously links to their site because it is bring back the default image, just not the gravatar which is linked to the email address given.

I have set up a gravatar for years now and it works on major blogs but when i test on my site it does not work.

The implementation process is:

<img src="https://secure.gravatar.com/avatar/<?php echo md5( strtolower( trim( $authorsemail ) ) ); ?>?s=60&d=mm" alt="<?php echo $authorsname ; ?>" class="gravatarimage" />

The $authorsname is just the email from the comment author as shown.

I have echo'ed the $authorsname and this is correct.

Any ideas why this is not working

MrCode
  • 63,975
  • 10
  • 90
  • 112
Robert
  • 907
  • 4
  • 13
  • 32
  • Works for me. Are you sure the email given by the user is the same as the one used to register with gravatar. – web-nomad Jan 24 '13 at 14:35
  • It could be a caching issue, have you tried pressing CTRL+F5 on the page? – Beardy Jan 24 '13 at 14:36
  • @Pushpesh Yes the email registered is the one i am using :( – Robert Jan 24 '13 at 14:38
  • @Beardy I am on a MAC and cant do this, when i press F5 and CMD or CTRL this does nothing to the page. – Robert Jan 24 '13 at 14:38
  • Could just be the browser, CTRL+F5 simply just causes the browser to perform a hard-refresh, reloading any elements that may have been previously cached. Alternatively you could just try manually clearing the browsers cache. – Beardy Jan 24 '13 at 14:41
  • Is this email your primary email address on gravatar? Just trying to tick all options. – web-nomad Jan 24 '13 at 14:43
  • @Pushpesh - Yes this is my primary email, ive been on the website of gravatar and checked the hash code of my email and the one on there and it matches so i am stumped :( – Robert Jan 24 '13 at 14:46
  • @Robert I can see your gravatar image on this question only. Please confirm if your hash is `8ef0172c4411ccaf409f7f6b84a79e24`. Check your Stackoverflow profile image...it is the gravatar one...so the hash that you are generating should match this one. – web-nomad Jan 24 '13 at 14:50
  • Try to test this on another domain/IP, your may be graylisted. I'd also recommend to test another account. And this could be something related to https (and plain http at your test URL). Also, try CMD+R instead of F5 ;) – Evgeniy Chekan Jan 24 '13 at 14:59

1 Answers1

0

When i replace the following:

<img src="https://secure.gravatar.com/avatar/<?php echo md5( strtolower( trim( $authorsemail ) ) ); ?>?s=60&d=mm" alt="<?php echo $authorsname ; ?>" class="gravatarimage" />

with the one below:

<img src="https://secure.gravatar.com/avatar/<?php echo md5( strtolower( trim( $authorsemail ) ) ); ?>?s=60&d=identicon" alt="<?php echo $authorsname ; ?>" class="gravatarimage" />

...it works. dd->identicon. It means you don't have an existing gravatar and therefore using the identicon as a value for d, you allow some random geometric patterns show up.

http://ma.tt/2008/04/identicons-from-gravatar/

web-nomad
  • 6,003
  • 3
  • 34
  • 49