Gravatar
|
|
download: Gravatar (61.36KB) added: 12/03/2009 clicks: 3554 description: A small .NET control that allows you to pull in a users Gravatar. |
For those that have been here before you’ll notice a huge change in the code. I went ahead and did this as a control class. There are 4 properties to be set: EMAIL, RATING, SIZE, ICONSET
You can access the code from SVN or download the project above.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Gravatar
{
public partial class Gravatar : UserControl
{
/// <summary>
/// Base URL for the Gravatar image
/// </summary>
private string BaseURL = "http://www.gravatar.com/avatar/{0}?d={1}&s={2}&r={3}";
public Gravatar()
{
InitializeComponent();
}
#region Properties, very ugly
/// <summary>
/// Email Property
/// </summary>
string theEmail;
public string email
{
get { return theEmail; }
set
{
theEmail = value;
UpdateGravatar();
}
}
/// <summary>
/// Rating Property
/// </summary>
public enum Rating
{
g, pg, r, x
}
private Rating theRating;
public Rating rating
{
get { return theRating; }
set
{
theRating = value;
UpdateGravatar();
}
}
/// <summary>
/// Icon Set Property
/// </summary>
public enum IconSet
{
identicon, monsterid, wavatar
}
private IconSet theIconSet;
public IconSet iconset
{
get { return theIconSet; }
set
{
theIconSet = value;
UpdateGravatar();
}
}
/// <summary>
/// Size Property
/// </summary>
int theSize = 80;
public int size
{
get { return theSize; }
set
{
theSize = value;
UpdateGravatar();
}
}
#endregion
/// <summary>
/// Small MD5 Function
/// </summary>
/// <param name="theEmail"></param>
/// <returns>Hash of the email address passed.</returns>
public string MD5(string theEmail)
{
System.Security.Cryptography.MD5CryptoServiceProvider md5Obj =
new System.Security.Cryptography.MD5CryptoServiceProvider();
byte[] bytesToHash = System.Text.Encoding.ASCII.GetBytes(theEmail);
bytesToHash = md5Obj.ComputeHash(bytesToHash);
string strResult = "";
foreach (byte b in bytesToHash)
{
strResult += b.ToString("x2");
}
return strResult;
}
/// <summary>
/// Update the Gravatar anytime an attribute is changed
/// </summary>
private void UpdateGravatar()
{
//hash the email address
string hE = MD5(theEmail);
//format our url to the Gravatar
string tU = string.Format(BaseURL, hE, iconset, size, rating);
//resize our control (I'm not using AutoSize for a reason)
this.Size = new System.Drawing.Size(size, size);
imgGravatar.Size = new System.Drawing.Size(size, size);
//load the Gravatar into our picture box. (maybe later I will load this
//into memory and paint it to the control instead.
imgGravatar.ImageLocation = tU;
}
}
}
Popularity: unranked [?]
78 Responses to “Gravatar”
-
pingback:
Posted: Mar 14th, 2009 at 2:26 pm1GravatarGet: Update | Life Of A JackassReply to this comment.[...] GravatarGet [...]
-
ericka
Posted: May 9th, 2009 at 8:33 pm2Reply to this comment.nao consigo colocar minha foto como faço para obter ajuda
-
martin
Posted: May 21st, 2009 at 4:07 am3Reply to this comment.How did you start it
-
Jah'Bara
Posted: May 23rd, 2009 at 10:00 pm4 -
bonus casino
Posted: May 24th, 2009 at 3:35 am5Reply to this comment.Post and article very interesting. Thanks for this post
webmaster: Bonus Casino – I migliori casino online con bonus in italiano. -
sherief_professional retouching
Posted: May 25th, 2009 at 7:35 am6Reply to this comment.please for all of you tell me..
do you think which one is more better
to be a programmer and know more than language
or to be a mind and ideas creator .and peoples programm it for you … -
Dora
Posted: May 25th, 2009 at 5:44 pm7Reply to this comment.I’m getting you. It actually worked quite well I must say. Good Job!
-
md:abusayedroni
Posted: May 26th, 2009 at 2:35 am8Reply to this comment.bismillah
-
web hosting reviews
Posted: May 27th, 2009 at 6:28 am9Reply to this comment.Thanks!
I Think I am going to change to library too. -
Solicitors Northamptonshire
Posted: Jun 8th, 2009 at 6:49 am10Reply to this comment.Awesome job, extremely useful thanks!!
-
tamiflu
Posted: Jun 8th, 2009 at 7:13 am11Reply to this comment.wow thanks! probably i’ll chage to library as well
-
abc
Posted: Jun 10th, 2009 at 8:27 am12Reply to this comment.grate job!very useful thing and thank u!
-
John
Posted: Jun 10th, 2009 at 11:07 pm13Reply to this comment.i love the name of this blog. Hilarious
-
albuterol
Posted: Jun 11th, 2009 at 3:50 am14Reply to this comment.It works!!!
Thank you.To sherief_professional retouching – it depends. For me is better to be a codder
-
доверительное управление
Posted: Jun 14th, 2009 at 8:27 am15Reply to this comment.Thanks for the C sharp version
Best Regards,
Доверительное Управление -
Konferenser
Posted: Jun 16th, 2009 at 10:16 am16Reply to this comment.Excellent explanation. Works perfectly. Got confused initially with a couple of steps,realized i missed out on them!
Thanks so much, this came in very handy to me, really needed this at the time..
-
pingback:
Posted: Jun 16th, 2009 at 8:15 pm17GravatarGet Life Of A Jackass | fix my creditReply to this comment.[...] GravatarGet Life Of A Jackass Posted by root 1 hour 7 minutes ago (http://lifeofajackass.com) The library is available in c and vb net it is very basic stuff however there are a lot of people i think i am going to change to library too reply to this comment 2009 from web powered by wordpress twitter widget pro Discuss | Bury | News | GravatarGet Life Of A Jackass [...]
-
Email Marketing Solutions
Posted: Jun 17th, 2009 at 7:45 am18Reply to this comment.i think this is a good idea. i love the work. i hope you keep churning out interesting things like this.
-
pingback:
Posted: Jun 19th, 2009 at 10:35 am19GravatarGet Life Of A Jackass | debt solutionsReply to this comment.[...] GravatarGet Life Of A Jackass Posted by root 3 days ago (http://lifeofajackass.com) I think i am going to change to library too reply to this comment xhtml you can use these tags lt a href quot quot title quot quot gt lt abbr title quot quot gt lt acronym title quot quot gt lt b gt 2009 from web powered by wordpress twitter widget pro go Discuss | Bury | News | GravatarGet Life Of A Jackass [...]
-
SearchMarketing
Posted: Jun 19th, 2009 at 11:04 pm20Reply to this comment.Excellent write up and thanks for posting your code. I would never have thought to do it like this.
-
bukmacher
Posted: Jun 20th, 2009 at 4:21 pm21Reply to this comment.good job, thanks for the code
-
johnstevens
Posted: Jun 22nd, 2009 at 5:39 am22Reply to this comment.п»ї
Agree with you! Nice read.
Great post, thank you|
Thanks post and site very nice…. very interesting.
Thanks for the link.
Nice! Thanks to author this post|
I have got it all worked out already by rereading ypur suggestion and this reply again. -
Buzz News
Posted: Jun 22nd, 2009 at 9:09 am23Reply to this comment.I was looking for something like this. A C# version. Thank you very much for sharing it with us. By the way I love your blog. Keep up the good work.
-
SEO Services
Posted: Jun 22nd, 2009 at 11:14 am24Reply to this comment.I will check it out! Excellent coding. Its very good that you actually came up with the idea of doing it by using c#. Thanks a lot for sharing.
-
webhosting guy
Posted: Jun 23rd, 2009 at 1:04 am25Reply to this comment.Great work dude, your post worth reading, it contains quite healthy information about coding.
-
hosting guy
Posted: Jun 23rd, 2009 at 3:24 am26Reply to this comment.Very interesting post, it worth a lot for me. You provide such important information in such impressive way.
-
digital channel
Posted: Jun 24th, 2009 at 2:42 am27Reply to this comment.i am just curious, is it possible to pull website favicon and expand it into a user’s gravatar? tnx
-
konferens
Posted: Jun 24th, 2009 at 4:53 am28Reply to this comment.Gravatars are just so convenient… plus you couldn’t make them easier to set up once you sign up for an account. The other day I had to tell some friends that visited my site to get on here and get some Gravatars made… which spurred me to make a post about it to get people a bit more informed. I’m sure if your server was overloaded, this was the likely culprit (haha yeah, I wish).
-
Lovelinks
Posted: Jun 24th, 2009 at 7:25 am29Reply to this comment.Thanks for the coding. It helped me a lot to understand. I use vb.net and this explains a lot. Thanks again. By the way I love your blog. Keep it up. Cheers !
-
business hosting monster
Posted: Jun 24th, 2009 at 10:59 am30Reply to this comment.Interesting post, at last i found some thing use on some blog, thanks dude, i like the way you describe this coding change.
-
shared web site hosting
Posted: Jun 25th, 2009 at 8:57 pm31Reply to this comment.Thanks for your blog.Very cool stuff.
-
Cheap Office Supplies
Posted: Jun 26th, 2009 at 2:49 pm32Reply to this comment.Genius coding. It s really good work actually. im sure this effort will not be wasted. It already has served a lot of people. Thanks a lot for this mate! Cheers
-
tamiflu
Posted: Jul 2nd, 2009 at 1:59 am33Reply to this comment.thanks a lot! it helped me
-
Tents
Posted: Jul 5th, 2009 at 10:31 pm34Reply to this comment.Awesome. Just what I was looking for. Appreciate it immensely. Cheers
-
Web Hosting Philippines
Posted: Jul 7th, 2009 at 12:24 am35Reply to this comment.Excellent explanation. Works perfectly. Got confused initially with a couple of steps,realized i missed out on them!
Thanks so much, this came in very handy to me, really needed this at the time..
-
Alex
Posted: Jul 10th, 2009 at 10:38 am36Reply to this comment.Do you think which one is more better
to be a programmer and know more than language
or to be a mind and ideas creator -
Andrew Croft
Posted: Jul 10th, 2009 at 5:40 pm37Reply to this comment.Thanks a lot, I am just starting out at all this stuff and this has really helped.
-
Home detox
Posted: Jul 10th, 2009 at 11:36 pm38Reply to this comment.You have explained it well… I have bookmarked this site for future reference… Keep going.
-
Zack
Posted: Jul 11th, 2009 at 4:55 am39Reply to this comment.It helped me a lot to understand. I use vb.net and this explains a lot. Thanks again. By the way I love your blog. Keep it up. Cheers !
-
Tents
Posted: Jul 15th, 2009 at 5:45 am40Reply to this comment.My friend told me about this site, and I came to take a look. This is great, we were looking for something like this. I think this will help us immensely. Thank you for sharing.
-
Gas Fires
Posted: Jul 15th, 2009 at 2:23 pm41Reply to this comment.Thank for the help. I made some changes to my site the other day, and noticed…where the heck are my gravatars? Had to figure out how to put back on. The best help was including the css info.
-
Pool Table Store
Posted: Jul 15th, 2009 at 10:18 pm42Reply to this comment.Awesome. I too had some problems with my gravatars recently. Got hem figured out now. Thanks bunch. Cheers. Keep up the awesome work.
-
Clip In Hair Extensions
Posted: Jul 18th, 2009 at 2:53 am43Reply to this comment.Just what I wanted. Thank god. Where were you guys all this time
Thanks again. -
lucy
Posted: Jul 19th, 2009 at 2:48 am44Reply to this comment.Excellent explanation. Works perfectly. Got confused initially with a couple of steps,realized i missed out on them!
-
Stock Clearance
Posted: Jul 19th, 2009 at 1:58 pm45Reply to this comment.I discovered Gravatar months ago – I’m frequently surprised how many sites automatically pick them up, it’s like fire and forget, I’ve got two set up depending on which email address I use.
-
Alex_R
Posted: Jul 22nd, 2009 at 10:04 am46Reply to this comment.Thanks! Where is my VS ^)
-
Safety Boots
Posted: Jul 23rd, 2009 at 1:07 pm47Reply to this comment.I would love to use this addon, but it doesnt work for me! I installed it (didn’t replace index.php because of version 1.6.0. Also, I replaced in image_template.html with . But there is no image showing up in my comments!!
-
Sold out concert tickets
Posted: Jul 24th, 2009 at 4:34 am48Reply to this comment.That’s awesome. Just the coding I needed. Thanks a bunch for it. Appreciate it. Cheers
-
Lap dancing jobs
Posted: Jul 26th, 2009 at 12:46 am49Reply to this comment.Awesome stuff. I really love the blog. Gravatars have always been my problem. Thanks a bunch for the explanation and code. Cheers
-
Sugoi Clothing
Posted: Jul 27th, 2009 at 3:12 am50Reply to this comment.I think its finally getting there for me, once i got the right combination of settings… thanks for the default link to a gravatar. I had to keep the first option of the email address blank for it to show my gravatar though, not sure why…Thanks for posting!
-
Online Pharmacy Store
Posted: Jul 28th, 2009 at 1:38 am51Reply to this comment.thanks! very useful! i needed this coding
-
LMS
Posted: Jul 29th, 2009 at 1:15 pm52Reply to this comment.I would love to use this add-on, but it does not work for me! I installed it (didn’t replace index.php because of version 1.6.0. Also, I replaced in image_template.html with . But no image shows up in my comments!
-
Jay @ Car Cleaning Products
Posted: Jul 31st, 2009 at 8:41 am53Reply to this comment.I am always really excited to watch where Gravatar expands beyond the blog commenting space. EditGrid seems to have seen the upsides of using Gravatar for profiles. They don’t have to worry about writing and maintaining a cropper, file storage, serving infrastructure, backups, etc. All they have to worry about is their core business: making a killer web based spreadsheet application.
-
car hire uk
Posted: Aug 9th, 2009 at 8:51 am54Reply to this comment.The other day I had to tell some friends that visited my site to get on here and get some Gravatars made… which spurred me to make a post about it to get people a bit more informed.
-
pingback:
Posted: Aug 10th, 2009 at 9:19 am55Les préoccupations d’un chef de projet Internet… » Gravatar : votre avatar universelReply to this comment.[...] .Net [...]
-
automotive blog
Posted: Aug 11th, 2009 at 9:35 am56Reply to this comment.That’s awesome. Just the coding I needed. Thanks a bunch for it. Appreciate it. Cheers
-
Online Pharmacy Store
Posted: Aug 18th, 2009 at 1:20 am57Reply to this comment.i agree with you! thanks
-
John Cook
Posted: Aug 23rd, 2009 at 7:42 am58Reply to this comment.Downloaded latest version, thanks a lot
-
Get Netted
Posted: Sep 6th, 2009 at 10:12 pm59Reply to this comment.Downloaded latest version, thanks a lot
Thanks so much, this came in very handy to me, really needed this at the time..
-
Solicitors
Posted: Sep 7th, 2009 at 5:05 pm60Reply to this comment.Great post, Downloading now!!! Thanks!
-
loans
Posted: Sep 8th, 2009 at 4:29 am61Reply to this comment.I found your blog on google and read a few of your other posts. I just added you to my Google News Reader. Keep up the good work. Look forward to reading more from you in the future.
-
kurye
Posted: Sep 8th, 2009 at 12:33 pm62Reply to this comment.GravatarGet :Life Of A Jackass great article thank you.
-
bestmed
Posted: Sep 10th, 2009 at 11:27 am63Reply to this comment.Get access to online drugstores that offer brand name and generic drugs and prescription medications. Now you can safely buy medication from licensed online Pharmacies at guaranteed low prices. Online prescription medication has never been so safe or easy.
-
web hosting philippines
Posted: Sep 17th, 2009 at 4:21 am64Reply to this comment.nice post. thanks.. very informative post. i’ll try this too.
-
Billig Fliegen
Posted: Sep 29th, 2009 at 8:26 am65Reply to this comment.Seams to be a great piece of software and I will give it a try – thank you for sharing it
-
car hire Murcia Airport
Posted: Oct 8th, 2009 at 9:09 am66Reply to this comment.I just added you to my Google News Reader. Keep up the good work. Look forward to reading more from you in the future.
-
Auto Versicherung
Posted: Oct 9th, 2009 at 10:39 am67Reply to this comment.“The download link has been updated for the new library.” I guess I have to update my libary – nice work.
-
concrete garages
Posted: Oct 14th, 2009 at 12:26 am68Reply to this comment.Hey, the post is awesome. But my problem is to asociate the gravatar image to an author image in my index.php Wordpress blog. I don’t know the correct sintaxis to do this. Have you any sugerence? Thanks a lot!!!
-
Bodybuilding Supplements
Posted: Oct 14th, 2009 at 10:04 am69Reply to this comment.I would love to use this addon, but it doesnt work for me! I installed it (didn’t replace index.php because of version 1.6.0. Also, I replaced in image_template.html with . But there is no image showing up in my comments!!
-
youth
Posted: Nov 3rd, 2009 at 3:52 pm70Reply to this comment.Great job on with this addon. I have been looking for this for a while.
-
PHP Form
Posted: Nov 12th, 2009 at 8:42 am71Reply to this comment.Thanks! thats perfect!
-
bukmacherski marco
Posted: Nov 12th, 2009 at 7:00 pm72Reply to this comment.best ive ever seen on bukmacherzy
-
computer repairs
Posted: Nov 17th, 2009 at 7:13 pm73Reply to this comment.Works great here, many thanks!!
-
pingback:
Posted: Nov 23rd, 2009 at 5:41 am74Add Gravatar support to your blog comments | Cre8ive CommandoReply to this comment.[...] .Net Gravatar Implementation [...]
-
pingback:
Posted: Dec 23rd, 2009 at 8:06 am75Linkit Blog » GravatarReply to this comment.[...] .Net [...]
-
Guest
Posted: Dec 29th, 2009 at 3:39 am76Reply to this comment.Its interesting,good work.
-
SEO
Posted: Feb 24th, 2010 at 11:45 pm77Reply to this comment.many thanks!!
-
luxury boutique hotels singapore
Posted: Mar 4th, 2010 at 2:54 pm78Reply to this comment.thanks for this nice post
