8/04/2012

How to Display Blogger Comment Avatar or Images ?



Adding profile images or better known as 'avatar' to blogger comments is a useful feature already enabled for all the blogger blogs, but its available only if you are using the default Blogger themes. Now to add avatars in your comment section for customized or 3rd party blogger templates, here's a quick look into this blogger hack.

If you are using the default blogger themes, go to Settings--Comments, scroll down and click on Yes in Show profile images on comments box, save the settings and its done! 




n case the profile images don't appear, then simply go to Design--Edit HTML and click the "Revert widget templates to default" link near the bottom of the page. This should do the trick! (This step is only meant for standard blogger templates)

For customized blogger templates, follow these simple steps. Go to Design--Edit Html, click on 'Expand widget templates' box and search for this line of code - 


<dl id='comments-block'>


  • or if your template uses 'div' then replace 'dl' with div.  

<div id='comments-block'>


  • Replace it with this code -

<dl expr:class='data:post.avatarIndentClass' id='comments-block'>

  • The next step will be to find this line of code - 

<a expr:name='data:comment.anchorName'/>


  • And immediately before it, paste this code -

<b:if cond='data:comment.favicon'><img expr:src='data:comment.favicon' height='35px' style='margin-bottom:-2px;' width='35px'/></b:if><a expr:name='data:comment.anchorName'/><b:if cond='data:blog.enabledCommentProfileImages'><data:comment.authorAvatarImage/></b:if>


Save the changes and the profile images or avatars will appear next to the comments. Please note, in case the author comments are highlighted in your template, then search for this code which will appear twice in the template -

<a expr:name='data:comment.anchorName'/>


and insert the above code again. 


For anonymous comments


Comment avatars are only displayed if the commentator is using Google or Blogger profile. If the reader is commenting anonymously or using URL, no image will be displayed. To add an image just add a small piece of code to your template. 

  • Search for this line in Edit Html -

]]></b:skin>


  • and right before it, insert this code, you can edit the width, height and image to be displayed -

/* Avatar */.avatar-image-container img {background:url(ADD_DEFAULT_IMAGE_URL);width:35px;height:35px;}


The last step would be to style the profile images so its displayed properly next to the comments, as shown in the top image. Insert this code in addition to the one given above, you can adjust the margin settings as per your preference and save the changes.


.avatar-image-container {width:35px;height:35px;float:left;margin:0px 10px 5px 2px;}


Hope you liked this tutorial, and post a comment in case you face any problem to get this working.

Kindly Bookmark this Post using your favorite Bookmarking service:
Technorati Digg This Stumble Stumble Facebook Twitter

0 comments:

Click Here To Add Your Comment

Confused? Feel Free to Ask

Your feedback is always appreciated. We will try to reply to your queries as soon as time allows.

Note: Please do not spam. Spam comments will be deleted immediately upon our review.

Regards,
Sarath S Pillai

Cool Dood Tricks

 

About The Author

Hi! I am Sarath S Pillai, currently live in Kerala, India. A young Web Designer, Pro Blogger, Print Media Graphic Designer & an addicted Web Developer. Read More...

Subscribe Us

Powered by:     

| Cool Dood Tricks © 2012. All Rights Reserved | | Contact | Home | Maintained by: Sarath |