You are required to register before you can post. This is via a custom verification system. Please post any problems you are encountering here and I`ll do my best to respond as soon as I can. Please note that a reply WILL be posted to all queries, so do not double post. There are no guarantees
when a reply will appear but I do my best to answer all within 3/4 days max. Bumping topics won`t make the slightest difference.
IMPORTANT: Posts in English ONLY please, thank you! Any other languages will be ignored and your message deleted.
SEARCH: Use the search option to see if your question has been answered on the forum before. Or check the relevant script docs.
CUSTOMER: If you have purchased a commercial version of any of my software, using the contact option at the licence centre ensures a faster response.
AUTO DELETION: Accounts older than 5 days, with no posts or topics, are automatically deleted. Only register if you are thinking of posting.
PRIVATE MESSAGES: Private messages are currently disabled.
LINKS: Any links posted are 'NOFOLLOW' and will not be picked up by search engines.
You are not logged in.
Pages: 1
Sorry to be a pest :-) LOL
I'm working on setting up gravatars in my guestbook rather then the avatars or permitting people to up load their own.
I hope it is OK to post the links & codes here if not I apologize. OK here is the link I have with my working gravatar so I know the code works I just need to find away for the code to pull the users email address from the post if they have a gravatar account then their picture will show if they don't I have it set to use the MonsterID avatars.
this is the page fetching my gravatar http://paranormalsos.com/guestbook/inc/gravatar1.php
here is the code
*** <?php
include_once('TalkPHP_Gravatar.php');
$pAvatar = new TalkPHP_Gravatar();
$pAvatar->setEmail('angela@paranormalsos.com')->setSize(80)->setRatingAsPG()->setDefaultImageAsMonsterId();
?>
<img src="<?php echo $pAvatar->getAvatar(); ?>" /> ***
Here is the code for the TalkPHP_Gravatar.php
*** <?php
class TalkPHP_Gravatar
{
private $m_szImage;
private $m_szEmail;
private $m_iSize;
private $m_szRating;
private $m_szDefaultImage;
const GRAVATAR_SITE_URL = 'http://www.gravatar.com/avatar.php?gravatar_id=%ssize=%sdefault=%srating=%s&default=%s';
public function __construct()
{
$this->m_iSize = 80;
$this->m_szRating = 'R';
$this->m_szImage = '';
$this->m_szDefaultImage = '';
}
public function getAvatar()
{
return (string) sprintf
(
self::GRAVATAR_SITE_URL,
$this->m_szEmail,
$this->m_iSize,
$this->m_szImage,
$this->m_szRating,
$this->m_szDefaultImage
);
}
public function setImage($szImage)
{
$this->m_szImage = (string) urlencode($szImage);
return $this;
}
public function setDefaultImageAsIdentIcon()
{
$this->m_szDefaultImage = 'identicon';
return $this;
}
public function setDefaultImageAsMonsterId()
{
$this->m_szDefaultImage = 'monsterid';
return $this;
}
public function setDefaultImageAsWavatar()
{
$this->m_szDefaultImage = 'wavatar';
return $this;
}
public function setEmail($szEmail)
{
$this->m_szEmail = (string) md5($szEmail);
return $this;
}
public function setSize($iSize)
{
$this->m_iSize = (int) $iSize;
return $this;
}
public function setRatingAsG()
{
$this->m_szRating = 'G';
return $this;
}
public function setRatingAsPG()
{
$this->m_szRating = 'PG';
return $this;
}
public function setRatingAsR()
{
$this->m_szRating = 'R';
return $this;
}
public function setRatingAsX()
{
$this->m_szRating = 'X';
return $this;
}
}
?> ***
Offline
Looks like you need to pass the relevant e-mail address into the class. I can`t see which part of the code checks if an image is available. However, try this:
1. Firstly, include a link somewhere at the top of the index.php page to your gravatar class.
2. Next, open the index.php file and find line 142:
$GBentries .= '<tr>
BEFORE that add:
$pAvatar = new TalkPHP_Gravatar();
$pAvatar->setEmail($entries['post_email'])->setSize(80)->setRatingAsPG()->setDefaultImageAsMonsterId();
$gravatarImage = $pAvatar->getAvatar();
On line 143 find:
images/avatars/'.$entries['post_avatar'].'
Change to:
'.($gravatarImage ? $gravatarImage : 'images/avatars/'.$entries['post_avatar']).'
Try that.
Offline
Thank you so much!! I'll give that a try. I love your guestbook it is the best I have seen yet & I have tried many! lol Do you have a banner that I could add at my site to link to your scripts?
Oh & it doesn't store photos it calls them from your gravatar account you can make it so it stores them in a cache or where it pulls them right from the gravatar site, lots of blog services use it like the wordpress blogs & others for comments & members That's how I found out about the gravatars and then I started added that service into my site.
Thanks again & take care,
Angela
Offline
And with this...
"Looks like you need to pass the relevant e-mail address into the class. I can`t see which part of the code checks if an image is available. However, try this:"
If the person has no gravatar account you can pick a default image or use another servers as listed in the 2nd code I posted if the person has no gravatar it will post an avatar for them like here http://paranormalsos.com/guestbook/inc/gravatar2.php I have it set to grab a MonsterID there are a few others to choose from but that one is best for the theme of my site :-)
Offline
YEAH!! It works :-) (I'm doing a Happy Dance) http://paranormalsos.com/guestbook/index.php OK Now I need to get it to show in the Preview area when signing & in the admin preview for approving messages
also another great feature with gravatars is you can set the rating for images to be view or not viewed
Offline
Hi Angela,
Glad you like my script.
Glad the code works. The preview option will be more difficult. If you get stuck I could help you out with a custom mod. Let me know via the contact option.
Offline
I got the preview OK for when people's signing the book I just have it listed as this
" - SIGN GUESTBOOK -
We use Gravatars for our Avatars
(with a Gravatar Pic here)
if you don't have one a MonsterID will be used "
I don't have it working yet in the admin preview I was thinking I may have to call it from the temp rather than the post? or from the java scripts :-)
Offline
Its been that long since I looked at the guestbook code I can`t remember it too well. The same code will probably work in the admin area?
Offline
Pages: 1