Ever wanted to use your Minecraft skin as an avatar on forums, websites, or just about anywhere else you can use an <img> tag? Well now you can, thanks to Cravatar!
What is Cravatar?
Cravatar is a just a shortcut to an image of your current Minecraft avatar’s face. It’s a bit like Gravatar, but there’s no need for any configuration beyond setting up a custom skin on Minecraft.net (which you’ve probably already done).
How do I use it?
Using Cravatar is easy. Anywhere you can display an image via URL, you can display your Cravatar. The URL looks like this:
In the form above,
<username> is your Minecraft username (case sensitive!), and
<size> is how big you want the image to be (in pixels). If you omit the
<size> parameter, the image will default to 16px.
My Minecraft username is tomheinan, so my Cravatar URL is “http://cravatar.tomheinan.com/tomheinan”, which yields . That’s pretty tiny, though, so let’s say I wanted a version 64 square pixels in size. I just use:
which gives me:
Easy! If you’d like to take a look at a more in-depth example, try the server status page. If anyone’s logged on, you’ll see their Cravatar next to their name.
What if the user doesn’t have a custom skin set?
You’ll get the default skin, and the HTTP status code returned with the image will be
203 Non-Authoritative Information instead of the normal
What’s the range of sizes?
As small as 8px to as large as 256px, 16px by default.
What format is the image delivered in?
I just updated my skin. Why hasn’t my Cravatar changed?
The script caches users’ skins locally, partly to avoid driving up Notch’s bandwidth bills and partly to deliver images as quickly as possible. The cache life is a few hours, so you may not see an immediate change, but your Cravatar will update itself soon.
Some other weird thing is going on!
Leave a comment below and I’ll try to help you out as best I can.
[message class=yellow-message ]Update – 27 Jan 2012 – The code’s now up on GitHub if you want to clone it and try it out on your own server![/message]