The easiest way to change default gravatar in BlogEngine.NET

Autor: tomasmatejka | 24. února 2009, 12:05 | komentáře (214) | permalink

When you use BlogEngine.NET for your blog, you know, there are gravatars supported.

You can choose one of this defaults:

Identicon

MonsterID

Wavatar

These looks good, but are too goofy for me. You don't have an option for choosing your own image. The easiest way to do this is modify 'CommentView.ascx' file in you theme folder ('/themes/yourThemeName/CommentView.ascx').

Find this code:

<%= Gravatar(80)%> 

Change it to:

<img alt="<%= Comment.Author %>" src="<%= "http://www.gravatar.com/avatar/" + FormsAuthentication.HashPasswordForStoringInConfigFile( Comment.Email.ToLowerInvariant().Trim(), "MD5").ToLowerInvariant() + ".jpg?s=80&default=" + Request.Url.GetLeftPart(UriPartial.Authority)+ Request.ApplicationPath + "XXX" %>" />

  where 'XXX' is path to your image (e.g. '/pics/Guest.jpg'). The output can look like this: 

komentáře



(Zobrazí Vaší Gravatar ikonu)  


biuquote
  • Komentář
  • Náhled
Loading