Dec 13, 2010 | 5 minutes | Tools
Gravatar is a service for providing user avatars. See how easy it is to use in Rails in this episode.
- source codeProject Files in Zip (93.9 KB)
- mp4Full Size H.264 Video (14.2 MB)
- m4vSmaller H.264 Video (7.48 MB)
- webmFull Size VP8 Video (14.9 MB)
- ogvFull Size Theora Video (17.7 MB)
I wrote a helper method to do this that takes option as a hash
this lets you do the same but isn't specific to a user model
It's okay Ryan. Easy episodes once in a while is just fine.
I'm already using Gravatars but I learned a couple things from this cast.
I confirm: It's okay to have an easy episode once in a while :) Thanks for the great work Ryan!
I would actually like to see more micro episodes like this one. Keep them coming!
BTW, shameless plug, for anyone willing to have the video embedded in this page (as HTML5 video tag), install this in safari: https://github.com/stuffmc/Embedded (download the .safariextz) - I hope to find some time to work on this toy again in the future :)
@Arcath - Yeah I threw together a similar helper method for a side project I've been working on.
Almost overkill to point out that the shorter Railscasts have often lots of value, and hey why make it more complicated than it is ;).
Thanx for this episode as much as for all the others.
Is there any downside to using Gravatar? I know that on my wife's blog we disabled the gravatars because the comment threads were taking forever to load because of all the gravatar calls. This sort of optimization is outside of this episode but it would be cool to discuss how to efficiently pull resources from outside services.
1. I didn't know github had this nice cross-authentication... finally the spam is gone. THANK YOU!
2. on your promise on "more in depth" stuff: I loved #240 http://railscasts.com/episodes/240-search-sort-paginate-with-ajax but it misses UJS-JQuery-Anchor-Tag addons for transparent back/forward browsing
I did try to adapt from #175: http://railscasts.com/episodes/175-ajax-history-and-bookmarks on Rails 3 but it didn't work for me... would be great if you could add an enhancement session on #240 on this topic maybe using the more recent BBQ http://benalman.com/projects/jquery-bbq-plugin/ or something alike. I am not deep into JS/JQuery and could not make it work for hours :/
Thanks in advance and keep up the awesome work!
Very nice. Very clear. I can't wait to try it.
This is also a great way (gem), how I handle this.
Authorizing with github... is that part of OmniAuth?
On the subject of OmniAuth, is it only authentication or is it Authorization? Before OmniAuth was released I created http://theSociable.me which uses oauth and oauth2 and authorizes 4 different social media's for posting (FB, twitter, buzz, and linkedin)
I didn't know that working with gravatar outside of a plugin was so easy... One comment is that I don't believe you put any size constraints on the users' avatar url ... that might cause some issues.
Not sure if I will use this since I have already implemented the user profile image cropping on another site and really like the flexiblity of that solution.
Thanks Ryan for the simple explanation. I am currently using a Gravatar gem on project but it got kinda messy. I believe this approach will work well for my app.
nice work, like it
Nice episode. Good timing as I was just thinking about implementing gravatar images the other day!
Nice short and sweet episode!
I was hoping you were going to "roll your own" gravatar support instead of using an unnecessary gem/plugin. I appreciate the effort behind stuff like gravtastic and all, but it seems like overkill in this case.
I've been doing this forever so I kind of feel like it's a waste, but hopefully people that don't use gravatar will now be convinced to use or or introduced to it.
Nice! Gravatar support was one of my first things I wrote in my very first project in Rails and described it on my blog.
Hi Ryan, Your iniciative is awesome, keep up the good work. I see, somethimes You don't have an idea of a useful screencast, maybe a voting script on your site with topics will do the job ? I would also suggest you more screencasts about testing techniques with examples. Regards
Short and simple is *great* when it comes to such a universal need as this. This has been one of my favorite 'casts in a while (along with the OmniAuth one) and I'm /sure/ I'll be using it within the next few months.
I was able to implement this in seconds :), however it doesn't render properly with users with missing Gravatars. Gravatar api has built in default image options for this scenario. See (http://en.gravatar.com/site/implement/images).
To use these options, just pass one of the following keywords as the d= parameter to an image request: 404, identicon, monsterid, wavatar, retro, blank.
Thanks, that's reaaly useful. Will apply.