Ravatar Wordpress plugin for random avatars |
I was looking for a Wordpress plugin to spice up comments with custom avatars, but I didn’t find exactly what I was looking for. So I hacked together the Ravatar Wordpress plugin that will display a randomly generated avatar for each visitor. The icons are based on email, so a given visitor will get the same icon each time they comment. It’s totally customizable, so you can set it up with images that match your blog’s theme. Visitors can optionally choose their own avatar by setting up a Gravatar. Download the plugin here.
The Ravatar plugin is based on Shamus Young’s Wavatar plugin which is quite good, but the generated avatars weren’t really what I was looking for.
Ravatar comes with a default set of images, or you can remove those and upload your own. It works by creating a hash of the email address, and then using the hash to choose an image and the place where the image should be cropped. Uploading your own images gives you the power to customize avatars for your site. A backpacking site might use use nature scenes. Or you might pick images that match your blog’s color scheme.
Here is a set of avatars that were generated by the plugin’s default images. I grabbed some images of oil paintings from Wikimedia Commons for the defaults.

To customize the plugin, upload your own set of images to the plugins/ravatars/parts directory. Supported image types are .jpg and .png. Its hard to say how many images you should upload. The minimum for a good set of ravatars is probably around 40, but you will want more if you have a lot of people posting and you want avatars to be unique for everybody. Try to get images with a lot of distinctive elements in them. If any images have large sections of one solid color, cropping those sections out will give you a more varied set of ravatars.
Here is a set of avatars Ravatar generated using the source images for my site (which are different from the Ravatar default images). I picked a set of HDR images that are mostly industrial, plus a few nature scenes. Leave a comment below to see what your own avatar looks like.
![]()
To install the plugin, get it here, unzip it, put it in the wordpress plugins directory, and enable it. Thats all there is to it.
The administration panel is under Options » Ravatars. You can adjust the size of the Ravatars, and assign HTML to come before and after each image to help nudge it into place. Each image is also set with the CSS “ravatars” class, so you can fine-tune the avatar position in your CSS file. For easy deployment, icons will automatically precede the commenter’s name.
If that still doesn’t give you enough control over ravatar placement and you don’t mind editing your theme, just turn off automatic placement and add the line
-
ravatar_show($comment->comment_author_email);
to your comment loop wherever you want the image to appear.
Note that the plugin requires that your install of PHP support the GD library. If it doesn’t, the Ravatars won’t show up and you’ll get a warning in the Ravatar admin panel. You can still use this plugin to display Gravatars, even if the GD library isn’t available. Image manipulation function are very memory intensive. If you get a memory error, try reducing the size of your source images by lowering the resolution or cropping them into smaller parts. You can also increase PHP’s memory_limit.
The readme.txt file that comes with the plugin contains a few other tips and tricks for using the plugin, so have a look at that if you are having trouble.
Related |
|





Seems a very cool plugin, however i get an error:
Fatal error: Call to undefined function: scandir() in /home/blablabla/public_html/wp-content/plugins/ravatars/ravatars.php on line 243
Something to do with file-permissions?
Hi Yuri,
It looks like scandir() is a PHP 5 only function. I’ll post a new version of the plugin that is compatible with both PHP 4 and 5 when I get a chance. Thanks for letting me know about this issue!
I just uploaded version 1.0.1 which should work with PHP 4 also. Anyone with PHP 4 able to verify that it works?
[...] wanted to add some flare to the commenting section of your WordPress blog? Grok-Code has coded up a nifty little plugin called Ravatars. Ravatars displays a random avatar for each [...]
Cool plugin. I just wanted to see what kind of icon I get.
Checking icon…interesting plugin
cool!
was wondering if i did not want the avatar uploaded to my plugins/ravatar/parts folder to be automatically cropped, can i edit the php file in a way so it doesn’t crop the image? meaning just randomly assign avatards to visitors according to their emails without cropping the images i provide? all images i placed in the folder are of the same size.
Hrrmmm. Interesting question Evern. You might be able to make this work without modifying any code at all. On the Ravatars options screen, try setting the icon size to the size of your images. Your icons will need to by square, and all of the same size like you say. Let me know if it works to do it that way…
i already done so and it doesnt work it randomly crops out parts of my avatar images…
Strange. If you are telling it that you want icons of say, 80 pixels, and all of the images in the plugins/ravatar/parts directory are 80 pixels, it should try to crop the image, but since it can’t be cropped it should just return the original image. It isn’t doing that?
Well anyway, it shouldn’t be that hard to do it in the code. On lines 258 and 259 you should have
$width_off = (hexdec(substr ($seed, 6, 5)) % ($width - AVATAR_SIZE));
$height_off = (hexdec(substr ($seed, 11, 5)) % ($height - AVATAR_SIZE));
Change those lines to
$width_off = 0;
$height_off = 0;
Thanks it worked!
I am really enjoying this plugin! Makes such a big difference to the look of the comments. Thank you!
Thanks for the comment Conrad!
Cool plugin. It will help us to give a personal touch to our blogs! Thanks.
nice plugin thanks!
Checking icon…interesting plugin
hmm - strange plugin behavior over here: http://maanzand.com
- when i activate gravatar support in the ravatar options, it only shows icons from users with a gravatar, the other icons (out of the ravatar-cache) get the standard blue gravatar-logo
- however, if i deactivate gravatar support, the blue-gravatar-logo-problem is gone, but - of course - there are no gravatars for users with a gravatar.
any ideas?
@Yuri I saw the same behavior here on GrokCode, which is why I currently have Gravatar support disabled. I suspect the problem stems from a change in the gravatars API. Gravatars was recently totally rewritten. I’ll be updating the Ravatars plugin within the next few days to fix the issue. Thanks once again for the feedback!
Ravatars version 1.0.2 which is now up fixes the incompatibility introduced by the Gravatars rewrite. Sites will stop showing the default Gravatar image now. Thanks to Demitrious at Automattic for the help!
Thanks a lot for the rewrite! Problem solved over here.
Oops. Problem not solved. Gravatar-users get a ravatar instead of their gravatar now. Even with gravatar support enabled in the options. Sorry.
Very nice. A useful option for a future release would be to let users actually crop their avatar on their own. Like that they could visually depict their moods. There was a plugin around that did this job but never updated to newer Wordpress versions. Thank for your good work.
@Yuri That problem should be fixed now too. It looks like an empty Gravatar rating was causing problems. Version 1.0.3 should work for you. *crosses fingers* By the way your site looks very interesting although I can’t read it
@karimun Interesting idea. And I think your point was made even better since your ravatar is all black!
Oooh yes. 1.0.3 to the rescue indeed. So stop crossing yer fingers, it worked!
I’m sorry you can’t read my site, it’s in dutch. But I have one article that is (partly) in english.
Perhaps you might enjoy the insane story of My Friend Kennedy Mobutu: http://maanzand.com/post/mobutu
Hi, I really love the plugin. And I don’t mind editing my theme, but I’m not experienced enough with php to understand your instructions. If I place the code into my comments php, only the text shows up, but not the ravatars. Do I need to add anything to the line? And what exactly do you mean with comments loop? I simply don’t know where in my comments php file to put that code!
[...] Ravatars [...]
@JunoMagic The easiest way to use ravatars is to just use the auto placement feature. If you really want to to customize the location you will need to know some PHP to edit your theme. The comments loop is a section of code that loops over and displays each of the comments. Since I don’t know how your theme works, I can’t give you specific line numbers for where the comments loop starts, but in my theme the comments loop starts with this line:
< ?php foreach ($comments as $comment) : ?>
Hope that helps.
coool!
Thank you, that’s very helpful!
“randAm”? LMAO…
Ooops! And its in the URL too. I’ll have to see how I can fix it without breaking external links…
very nice!!
I’m sorry, is this how I place ino my comments.php file?
sorry, didnt place it right.
comment_author_email); ?>com*ment_author_email); ?*>
whatever, i cant place it right without it not showing up. i even tried useing code tags. and now im spamming your comments. thanks anyway.
@Becky Wordpress likes to break code within comments. Sorry about that. If anyone wants to recommend a plugin for fixing that, I’d be glad to hear about it.
I would suggest using the autoplacement feature of the plugin to avoid mucking around in the PHP.
But if you really want to do it try calling
ravatar_show($comment->comment_author_email);
within the comments loop in the comments.php file.
That line needs to be within php tags.
What kind of php code do you need to put around the
ravatar_show($comment->comment_author_email);
comment_author_email); ?> ? Or something else? Because when I ONLY put the bit of code in that you recommend in the options page, it doesn’t show anything at all.
I want to use your plugin within Brian’s nested comments, and I can’t get it positioned properly using only CSS. So I’d really rather call it manually. But while I’ve done quite some fiddling with my theme files already, I’m not sure what kind of php code I need to get your ravatar_show to work.
Nrgh. The comment form ate parts of my code.
Sorry.
Would that be
<? php ravatar_show($comment->comment_author_email); ?>
or something else?
@JunoMagic Yes, the ravatar_show funtion needs to be inside of php tags, so try this: < ?php ravatar_show($comment->comment_author_email); ?>
The comment form isn’t playing nice with my code either. In the above comment, there should be no space between the ‘<’ and the ‘?php’
Thank you- I really appreciate your patience. I can move it now - which is great! But now it only shows one and the same avatar for all commenters! Including me as the admin?! I guess I should just give up …
@JunuMagic It sounds like the line where you call ravatar_show is outside of the comments loop. Try finding the start of your comments loop and then the closing } that matches with it. There might be many nested matching brackets inside of the loop that you can disregard. Not sure how much sense that makes if you are not a programmer, but I hope it helps.
The plugin doesn’t work in my wordpress.
The following sentence is shown in the option page:
“Warning: opendir(../wp-content/plugins/ravatars/cache) [function.opendir]: failed to open dir: No such file or directory in /home/chinakolau/domains/chinakolau.com/public_html/wordpress/wp-content/plugins/ravatars/ravatars.php on line 162
Cannot open directory for reading.”
I would like to ask if I can do anything to fix the problem.
Thx!
@Carmen It looks like a file permission problem. Try creating a directory called cache inside of /wp-content/plugins/ravatars, then make sure that the owner of the directory has read, write, and execute permissions on the directory. This page has some additional info on changing permissions if you need it: http://samdevol.com/wordpress-troubleshooting-permissions-chmod-and-paths-oh-my/
Hi,
I’ve almost got this working, but not quite. I get this error:
Warning: opendir(../wp-content/plugins/ravatars/cache) [function.opendir]: failed to open dir: No such file or directory in /xxx/xxx/public_html/xxx.xxx/weblog/wp-content/plugins/ravatar/ravatars.php on line 69Cannot open directory for reading.
I made sure that the permissions were all correct, and there’s a cache folder within the raratar plugin folder.
Any suggestions?
And a quick questions: There’s support for.jpg and .png files, but not for .gif — will this change at some point?
Thanks for your help — and the plugin.
@Carmen & Rosina What version of wordpress are you guys on?
@Rosina If there is a lot of demand I add .gif, but first on my list is to update the plugin for official wordpress 2.5 support. There is never enough time in the day…
I’m on 2.5 — and I’m guessing, from the rest of your message, that this plugin is not 2.5 ready.
@Rosina I’m still working on the admin interface and options for 2.5. I hadn’t come across the problem you are having yet, so thanks for being a beta tester, even if you weren’t aware of it
I’m hoping to get a version out for 2.5 in the next week, so you might want to sit tight until then.
Jess — any hope of the 2.5 version soon? Thanks again.
hi there .thanks for plugin:
Does anybody know if tis script is compatible with Wordpress 2.5.1 ?
Thanks in advance for any help on this!
regards
OK everybody, I apologize for the delay. Ravatars is 2.5.x ready at last. If you are on 2.5.x, your theme needs to be avatars enabled for the plugin to work.
As always, let me know if you have any problems with the plugin, and I’ll try to help out.
I get the following error message when trying to activate the plugin:
BTW: I run 2.5.1…
Oops. Thanks for the heads up Latterlig! I did something weird when registering the function with wordpress, and didn’t catch this bug since I upgraded without deactivating and reactivating. Ravatars version 2.0.1 fixes it.
Thanks. But it still doesn’t work. No ravatars show up (I will double check my theme to be sure it has a get_gravatar line), but on refreshing the cache, it “Cannot open directory for reading”. I’ve checked, and the directory exists, even though I had to create it myself.
Latterlig!, check the permissions of the cache directory, and make sure that the plugin has permission to write there. If there are still problems, post the exact error message and if possible a link to where I can see the error on your site. Comment here or shoot me an email to jess [AT] grok-code.com
Lets see if we can get this fixed.
I’ve checked now. Permissions are 777 and it still doesn’t work.
Error message is
“Cannot open directory for reading.”
Maybe I checked the wrong directory? The plugin says:
“/wp-content/cache/ravatars”
Hrmmm. The plugin should be looking for ‘/blah/wp-content/plugins/ravatars/cache’ so something funny is going on here. What are the permissions of that directory? What is your PHP version (your hosting company should be able to tell you)?
Does the error message have a line number? Please give me the entire error message.
I did some research and found the url to the cache in the .php file. The text in the settings > ravatars, at the bottom, is wrong. Check it yourself in your own installation.
I created the directory manually, and the cache seems to be working ok. The plugin should create that directory, though.
And the plugin is not working (I don’t see any ravatars/gravatars). I’m also using the Ajax Comments Reply (http://zhiqiang.org/blog/plugin/ajaxcomment) and that might be the problem. But the get_gravatar line works fine when ravatars is not activated.
Ok typo in admin panel has been fixed.
Yes it should have been created by the plugin. There was an edge case where the directory was not created properly. Fixed.
Grab the latest 2.0.2 version of the plugin which fixes the above errors. If the ravatars still don’t display, do a view source on the page, and post the URL of some of the ravatars it is trying to get. The code you are looking for will be something like:
img class=’ravatar’ border=” src=’http://grok-code.com/wp-content/plugins/ravatars/cache/c4bb682be6f940454.png’ width=’80′ height=’80′ alt=”
It’s getting better. Now the gravatars show up, but not the ravatars.
This one doesn’t show:
http://www.gravatar.com/avatar.php?gravatar_id=dde663353f0b2811765ae7df5d70a1ea&rating=X&size=80&default=http://spesiell.org/wp-content/plugins/ravatars/cache/dde663353f0b28117.png
OK. So its looking for the ravatar located at /wp-content/plugins/ravatars/cache/dde663353f0b28117.png but that is giving a 404 not found error. Have a look and see if that file exists. If so, its a directory permissions problem. If not, its plugin bug.
The file exists.
OK it looks like we are close. Open up permissions on the cache directory. If the file exists, and you are able to resolve this URL: http://spesiell.org/wp-content/plugins/ravatars/cache/dde663353f0b28117.png the whole thing should work.
Jess — I think it is working now. The problems that remain I think are probably my fault. One BIG question: on the options page I don’t see anywhere to specify size of the ravatar, or what to put before or after it. Can you point me to it more directly? Thanks
Hi Rosina. I took those options out of 2.5 since in 2.5 that is really the job of your theme. The directions in the post above are all for pre 2.5 which is a bit confusing. I’ll edit them when I get a chance.
In order to edit the size of the ravatars, look in your theme for the line get_avatar. In the default theme the line is in coments.php and says get_avatar($comment, 32) Change 32 to the size you would like the avatars to be. You can also add your html before and after get_avatar to help position the avatars.
And thanks to everybody for their patience while getting the kinks sorted out.
A nice idea, but all I get is a generic icon missing display when I try to use it. Regular Gravatars appear properly. Your cache folder is given a 755 chmod setting by default after installation.
I can give you specifics about my installation if you wish, but for now it’s just WP 2.5.1.
Thoughts anyone?
Peace,
Gene
@Gene there are a few things you can check to help narrow down the problem:
Is Ravatars able to create any avatars i.e. is there anything in the cache directory?
Do a view source on your page and look for a line like:
img class=’ravatar’ border=” src=’http://grok-code.com/wp-content/plugins/ravatars/cache/c4bb682be6f940454.png’ width=’80′ height=’80′ alt=”
What is the img source it is trying to use?
I have the option to use Gravatars if available, and it insists in pointing to a Gravatar even if one doesn’t exist.
So I get this:
That provide a clue?
Peace,
Gene
Sorry, deleted the code.
Let me try again:
Peace,
gene
Let me try again
img class=’ravatar’ border=” src=’http://www.gravatar.com/avatar.php?gravatar_id=eedf4ac9e08cd39ad20c491cea6f7932&rating=G&size=32&default=http://macnightowl.com/wp-content/plugins/ravatars/cache/eedf4ac9e08cd39ad.png’ width=’32′ height=’32′ alt=”/
Hope 3 times a charm.
Peace,
Gene
Hi Gene, the comments form likes to eat code. Go ahead and send me an email if it happens again: jess [AT] grok-code.com
If you have the option checked for using gravatars if available the source should look something like this:
http://www.gravatar.com/avatar.php?gravatar_id=dde663353f0b2811765ae7df5d70a1ea&rating=X&size=80
&default=http://spesiell.org/wp-content/plugins/ravatars/cache/dde663353f0b28117.png
The &default bit is url of the ravatar to be used if that email address doesn’t have a gravatar.
OK, I think we got a post up that does have the code which resembles yours above. However, non-gravatar avatars aren’t being displayed on my site (I turned the plugin off for now). Just generic icons, not even the non-Gravatar default.
So?
Peace,
Gene
Looking at your site, an example of a ravatar it is trying to get is http://macnightowl.com/wp-content/plugins/ravatars/cache/eedf4ac9e08cd39ad.png which is giving a 404 not found.
Does that file exist on your system? Are there files in the ravatars cache? There might be permissions issues that prevent it from being displayed. Or there may be a security plugin or other plugins installed that is blocking access to the file.
There are files in the ravatars cache It is turned off for now, by the way.
As to security plugins and such, I’m using WP-Spam Free and Akismet, both latest versions. Permissions are at 755 for most folders/files in the wp-content folder.
Clues?
Peace,
Gene
Hrrmmm. Strange. Here are my permissions:
wp-content 755
plugins 755
ravatars 755
cache 755
How do yours compare?
Same.
Peace,
Gene
Unless you’re otherwise occupied, can I assume you’re stumped?
Peace,
Gene
Ha! I’m not giving up yet. It could be something in your .htaccess files. If you know how to analyze them, look for anything that would prevent this URL from resolving: http://macnightowl.com/wp-content/plugins/ravatars/cache/eedf4ac9e08cd39ad.png If you don’t have much experience with .htaccess, send them to me and I’ll have a look. We will need to look at a file called .htaccess in every directory from the document root down to cache.
Here’s the one at the main level of that particular URL. There’s nothing in any of the WP sub-folders, except for whatever they install:
order allow,deny
deny from all
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^.htaccess$ - [F]
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.macnightowl\.com$
RewriteRule ^(.*)$ http://macnightowl.com/$1 [R=301,L]
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/(stats|failed_auth\.html)/?(.*)$ [NC]
RewriteRule ^.*$ - [L]
# BEGIN WPSuperCache
RewriteEngine On
RewriteBase /
AddDefaultCharset UTF-8
RewriteCond %{QUERY_STRING} !.*s=.*
RewriteCond %{QUERY_STRING} !.*attachment_id=.*
RewriteCond %{HTTP_COOKIE} !^.*(comment_author_|wordpress|wp-postpass_).*$
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz -f
RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz [L]
RewriteCond %{QUERY_STRING} !.*s=.*
RewriteCond %{QUERY_STRING} !.*attachment_id=.*
RewriteCond %{HTTP_COOKIE} !^.*(comment_author_|wordpress|wp-postpass_).*$
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html -f
RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html [L]
# END WPSuperCache
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
Part of this is for WP Super Cache and to force www to non-www, plus the normal WP stuff and the addition for proper stats.
Peace,
Gene
Some of the foregoing code is missing because of the way your comments panel parses it, but I think you have the essentials there, when you add proper codes as appropriate.
Peace,
gene
Hrmmm. I don’t see anything there that looks particularly relevant, but its possible I missed something. I would like to try to rule out the possibility that it is either .htaccess or a WP Super Cache conflict. Can you try this test?
1. Deactivate the WP Super Cache plugin
2. Verify that everything between ‘# BEGIN WPSuperCache’ and ‘# END WPSuperCache’ in .htaccess has been removed
3. Comment out part of .htaccess by putting a ‘#’ in front of each of these lines and save the file
4. Make sure the Ravatars plugin is activated, and your browser cache is cleared. Do the ravatars show up?
5. Remove the #’s you added in step 2 and save the file. Reactive WP Super Cache.
Note that this test will remove caching and stat tracking on your site for a short period of time. Get a backup of your original .htaccess before you start.
I tried each and it failed to change anything, so I’m back to the normal config.
Is that stat stuff actually needed? I picked up up when I was at DreamHost last year, and never changed it. I’m no longer there, so what’s the skinny?
Peace,
Gene
I think that section is to hide access to any stat files or log files that dreamhost was creating for you. If your current host isn’t using files or directories called stats or failed_auth.html you should be safe removing it.
Can you give me a full list of all of the plugins you have installed so I can try to rule out plugin conflicts?
I’m also going ask around a bit about your problem on a few mailing lists and see if anyone knows how to fix this. We have ruled out file permissions and .htaccess problems, I can’t think of what else could cause a 404 on the http://macnightowl.com/wp-content/plugins/ravatars/cache/eedf4ac9e08cd39ad.png URL. Could you humor me and check one more time that that file really does exist? Open it and make sure it’s a normal image.
Oh and one more quick test. Enable ravatars, then in the ravatars option panel, disable gravatars. Does that change anything?
Disabling gravatars makes no difference. I did remove the stat entry, since it appears not to have had any negative impact.
Here’s the list of active plugins, other than you:
Akismet 2.1.5
All in One SEO Pack 1.4.6.8
Automatic Timezone 1.0
Clean Archives 3.0.0
DBD Mailto Encoder 1.0
FeedBurner FeedSmith 2.3.1
Google XML Sitemaps 3.0.3.3
InstantUpgrade 1.0-beta2
Mail From 1.0
Quoter 1.1
ShareThis Classic 1.5.2
Simple Tags 1.5.7
Star Rating For Reviews 0.4
StockQuoteSB 1.3
Subscribe To Comments 2.1.2
WordPress Mobile Edition 2.1a
WP-DBManager 1.30
WP-Print 2.30
WP-ServerInfo 1.30
WP-SpamFree 1.8.3
WP-Sticky 1.30
WP Ajax Edit Comments 1.1.5.1
WP Super Cache 0.6.4
So far as I can tell, it’s all the latest and greatest.
Peace,
Gene
Great thanks for the plugins list. I’ll see what I can find out.
Were you able to open the image file in ravatars/cache? You’d have to get it with an ftp client.
I can open the image directly, yes, via the URL.
But it won’t appear on the page.
Peace,
Gene
Hi Gene,
I like this plugin and nice work, but I’m not able to see the ravatar images. I just enabled the plugin, I also have the gravatar site enabled (I can see the gravatars of user that have them) but the ravatars doesn’t appear. I realised that the final html code generated link with cache images that doesn’t exists (error 404 if I try to see them on the explorer). When I navigate over the site, I can see how the cache folder grow up. But then doesn’t appear.
Could you take me a hand with this please?
My site is http://www.unraticode.com.
I’m not the programmer. I have the same problem you do.
Peace,
Gene
What version of Wordpress do you have Jonatán?
Sorry Gene, Hi Jess, I’m on 2.5.1
Thanks.
OK guys. Disactivate and delete the Ravatars plugin files, then download and install the new version (2.0.3)
Wow! It works perfect right now.
I never seen a faster programmer serving his users. Bravo!
Just a little question. Is there any way to resize the image instead of cropping it?
Thank you very very much.
So it works now. Thanks.
Peace,
Gene
Sweet! Glad I could help.
@Jonatán - There isn’t a way to resize the images with the plugin, but you could resize your images manually before uploading them. I’ll consider adding resizing as a new feature…
To which size. It always crop the images and add an pixel offset to them. I tried with 80×80, 160×160 and 200×200. Always the same result. You can see them here.
Best Regards.
Thank you so much for this plugin, I really like it. Now I’ve just got to make my own pictures.
Hi.
I am trying to get this ravatar thing going, I have upload a bunch of 100×100 pics into the parts directory of ravatar but when they are generated they only take a corner of the picture and then the rest of the avatar is black. So i end with only one corner of the avatar being a picture, and it’s not even a good corner. How do I fix this? can you not have the whole image used as an avatar?
Also I only have a new site, with only 2 users (only day 2 of site!) and I thought maybe if I cleared the cache (which I had to create as there was no cache directory) it might generate me a new avatar, and now I am getting nothing! no avatars for me or the other user who never had one generated before.
I’m confused help!!
What size avatars are you using? Ravatars crops the images so that they are the size that the theme specifies - it won’t resize anything. You can have the whole image used as the avatar, but the source images need to be the same size as the avatars in the theme for that to work. I’m not sure why part would be black if there isn’t any black in the source images. Strange. Do you have an example? Or a link where there are comments, but the avatars aren’t showing up?
how can I include my own picture collection?
… and how can I have smaller pictures for the “New Comment” sidebar?
hi,
how can i make the avatars show in the “recent comments” widget? i am using neoclassical theme, i think i need to tweak it myself.
thanks a lot in advance!
@Chris replace the images in the ravatars/parts directory with your own images. Look for the call to get_avatar() in the sidebar. It will look something like this: get_avatar($comment, 32) The number at the end is the size the avatar should be. Unfortunetely, if you have avatars of 2 different sizes for the same person, they will be different parts of the same source image, so they won’t look the same.
@explorish Try adding the code get_avatar($comment, 32) inside the comment loop code for the recent comments. Change the 32 to whatever size you would like the avatar to be.
@jess
thanks - i dont find a “recent comments” loop. i dont have such a file in the theme, and i don’t have a get_avatar command (i introduced it myself in the “comments” loop, it shows up with the post comments, but not in the sidebar widget. i can’t find any recent comments section anywhere - not in the sidebar, not in the left bar… any suggestions?
thansk a lot!
@explorish How are you getting the recent comments? Through a plugin? If so, have a look in the plugin code and you should find a recent comments loop there. Then add get_avatar the same way you did for the regular comments loop.
no - thru the normal “recent comments” widget, that comes with the theme. i see no php for the respective widget…
@explorish hrmmmm. Is there anything interesting in your theme’s functions.php that looks like the code for the widget? If you don’t have a whole lot of experience with PHP, email me that file and I’ll have a look. jess [AT] grok-code.com
Hi there. Ravatars is no longer working on my site. I’m not sure when it stopped, cuz I’ve had a lot of various issues lately and it escaped my notice til the other day. I followed the advice above, including editing my htaccess file, and completely broke my site and had to go so far as delete the entire site and start over (including uninstalling Wordpress three times!). I finally stumbled upon the answer to the break for the site (had to do with wp_redirection plugin, and I had to drop the database tables for that plugin for my site to start showing up again; I’d been getting a blank page.)
But after all that, ravatars still do not work. I’m using the newest version of Wordpress with a fresh, clean install of the latest Ravatars plugin. I’ve already tried removing all other comment-related plugins, and when it didn’t help I put them back. All other plugins I’m using are:
Admin Drop Down Menus
Akismet
All in One SEO Pack
Better Comments Manager
Category Icons
cforms (Currently disabled)
Clean Archives Reloaded (currently disabled)
Click Tags
CommentLuv
Cricket Moods
Excerpt Editor
FeedSmith
FireStats (currently disabled)
Google XML Sitemaps (currently disabled)
Homepage Excerpt (currently disabled)
KB Advanced RSS Widget
Maintenance Mode
MaxBlogPress Ping Optimizer
Mini Posts 2
My Page Order
NexGen Gallery (currently disabled)
Official Statcounter Plugin
Page Category Plus
Post Avatar
Register Plus
Search Unleased
Simple Trackback Validation
Subscribe to Comments
Tag Functions (currently disabled)
TagMahal
Wordpress Duplicate Content Cure
WP-dtree
WP-OpenID (currently disabled)
WP-Polls
WP Ajax Edit Comments
WP Captcha Free
WP Super Cache (currently disabled)
Now I do like Ravatars and am willing to kill less essential plugins for it, but nothing that is important. For the record, I have tried deleting all plugins and starting with Ravatars, and it didn’t work alone, either.
Are comments moderated? Cuz mine vanished, and I didn’t get any sort of confirmation that it would be added on approval… (this is a test).
@Sheta Wow. Sounds like you’ve been having a tough time. Maybe I can help…
What exactly is the plugin doing now? Are you getting gravatars but no ravatars? Or neither? If you view source on a page with comments, can you see the code where it is trying to display ravatars?
Your original comment had to be rescued from the spam filter, thats why it vanished.
@jess - Hi. My site is down again; it seems to hate me this week and I’ve had to put in a call to my webhost. But to answer your questions…
Neither Gravatars nor Ravatars show up; HOWEVER, I can see the ravatars just fine on my manage comments screen. They’re just not displaying on the public pages. This of course is when the site is working. heh. I can say however that this behavior has been consistent through the entire unrelated nightmare of the many crashes of the entire site this week.
Ahh spam filters.
lol
@Sheta hrmmmm Without seeing your public pages, I don’t know that there’s a whole lot I can do to help. Do you want to give me an update when I can see the pages that aren’t displaying ravatars? Good luck getting your site back up!
[...] Ravatars 2.0 [...]
@jess: Thank you for your work on this, this is one of the best plugin ideas out there. All it needs is a little tweak… I read your dialogue with Evern, who wanted non-cropped random avatars. Allowing people to simply have an uncropped random avatar assigned to guests from a directory would be great.
Personally, I’d just like to get some small .gifs going for mine. I’m not too good with code, so it’s a trial-and-error process… Whatever Evern did to make it work ain’t workin’ for me. I’m trying to figure out what I can break that would stop the generation process and just return whole avatars, and possibly allow animated .gifs. ‘Don’t suppose I could bother you for some pointers could I?
@Sheta: I think I know what your problem might be (hope you’re not still dealing with too much trouble by now). I had the same thing happening to me, where images wouldn’t appear on public comments but they would show up when managing comments. It turned out that it was my theme’s comments.php file that was the cause. Try switching to a different theme; if avatars show up then it’s probably that your current theme’s comments.php file is missing this: Once I figured out where to put that, it was all fixed.
@Gatero Those are good ideas for the next version of the plugin. I’ll see if I can get a version out soon that has the option for not cropping and also allows .gifs. Thanks for the feedback!
I’ve found the solution to Sarahe’s problem, where only the corner of a ravatar displays the image while the rest is black. The problem lies in the line: define(”AVATAR_SIZE”, ‘80′); on line 15 of ravatars.php. Change this to the desired size (in Sarahe’s case, 100), so that it matches the setting. When the value matches the avatar size of the theme, it should return the image in the right size… or at least, it fixed my problem when I changed that.
Keep up the good work jess, I’ll be watching for the next version!
@Gatero: Your code didn’t show up. Can you repost in a way that allows it to display? Thanks!!
@Gatero addendum: My Ravatars used to show up with the theme I’m using, but don’t now. I’d still like to see the code, though.
I’m trying this avatar…
[...] Ravatars 2.0 [...]
Test.
to procurando a diferença do WP-Gravatar do Ravatar
This is a great plugin
Just a test.
[...] j presents Ravatar wordpress plugin at GrokCode posted at GrokCode , saying, "Plugin page for the popular Ravatars wordpress plugin. This [...]
[...] j presents Ravatar wordpress plugin at GrokCode posted at GrokCode, saying, “Plugin page for the popular Ravatar WordPress plugin. This [...]
Supports Gravatar? I’m looking for a plugin that show random images just if commenter doesn’t have a Gravatar.
Yes, it has an option use a Gravatar if available.
Hi,
Thanks for creating and sharing this awesome plugin, It’s just what I was looking for, but I was wondering if there any way to assign a different image class and have two seperate instances of the ravatars so I can control them independantly..
On my blog I have smaller sized ravatars showing up with the recent comments on front page, but whatever changes I make to the img.ravatar affects the ravatars on single post comment loop too and they go all whacky sort of thing. It’s on a local server at the moment, but Im hoping to upload it later.
Many Thanks, this plugin rocks.
Martin
@Martin You should be able to make it work without 2 different CSS classes for the ravatars. Use something like #sidebar .ravatar to style the ravatars in the sidebar differently from the ravatars in the comments. The exact selectors you use will depend on your theme.
Glad you like the plugin!
This is a great plugin!
I downloaded and successfully installed ravatars to my site. However, when I uploaded my own images to the parts folder and then subsequently emptied the ravatars cache, no images appeared.
I figured my images perhaps corrupted it, so I re-downloaded a fresh version of ravatars and uploaded it. Now the only time I see the ravatar, is in the edit comments admin window. Any ideas about how to get it up and running again?
I forgot to mention that when I had initially installed the plugin, I did see the ravatar right away in the comment. It was only after I put my own images in that the ravatar didn’t show. Fresh download with original images now doesn’t show ravatar either.
Sorry to post so many times. I’m using wp 2.7. The icon that I saw pop up when I initially enabled the plugin was called “Mystery Man”. I couldn’t find this image in the parts folder, so I wonder if Ravatars created it at all. 2.7 asks in the discussion area if I want gravatars, wavatars, identicon, blank, or mystery man to show up? I’m a little lost.
I guess mystery man is a ravatar generated icon. It seems to be a fragment of a file in the parts folder. I can see mystery man icon and another oil painting fragment representing 2 users in the USERS area. So the only place ravatars aren’t showing up anymore is in the comment itself! This is a great plugin, I really hope you can help me to use it - and I will donate! Thanks. W
@wwwindi Ravatars isn’t officially supported on WP 2.7, but maybe we can make it work anyway. Go to the Ravatars options page, and tick the ‘automatic placement’ box (if it isn’t already). Click the update options button. Does that change anything?
There doesn’t seem to be the option of ticking the ‘automatic placement’ box available there. There is no box to tick!? This would be within Settings/Ravatars/Ravatar Options pg right?
Strange how the plugin worked when I installed it, but when I emptied the cache, it didn’t display within comments, but everywhere else it’s there. I thought it might have something to do with the cache. It says I have a cache, but I can’t seem to find it in the plugins folder on my site or elsewhere. Do I need to create one?
Just re-installed the plugin with cache folder that I created within it, cuz I got this error when I installed before:
Warning: opendir(/mnt/local/home/wwwindi/innerstellarmedium.com/wp-content/plugins/ravatar/cache) [function.opendir]: failed to open dir: No such file or directory in /mnt/local/home/wwwindi/innerstellarmedium.com/wp-content/plugins/ravatar/ravatars.php on line 213
Cannot open directory for reading.
The error did not come up again, but still no icon in the comment itself. Weird how it worked at 1st and then doesn’t now? In Settings, there is Favicon where I see a few options as to how to tweak it, but not all of them, especially not autoplacement. Thank you for your help. I love this plugin and hope I will eventually get it to work in 2.7!
Since there are no Options corresponding to autoplacement, shall I tweak things inside the plugins editor in the code? Icon shows up in USERS and in Manage COMMENTS but no longer in the actual comment itself even though it did upon initial installation.
@wwwindi Sorry about the troubles you are having. You’re right, you won’t see the autoplacement option in that version of wordpress. Looking at your site, I see that it is creating ravatars, although I’m not sure if they are from the default images or from the custom images you uploaded. I would go ahead and modify your theme to put a call to ravatar_show($comment->comment_author_email); in your comments loop. Are you able to see ravatars after making that change?
I had to create the cache directory (and set ownership correctly) for this to work, and then I decided to make the picture selection a little more dynamic. We have the ‘NextGen’ plugin installed, so I did this:
cd wp-content/plugins/ravatar
mv parts oldparts
ln -s ../../gallery/cache parts
Now the ravatars are made up of images that are already on my blog. Works nice. Thanks much for a great plugin!
[...] Ravatars [...]
Can I use Ravatar plugin together with Gravatar plugin? And if I only put two images in parts folder, so those two images will be going random repeatedly right?
test
Jess, did you ever solve the below problem that explorish had? I have the exact same problem. I cannot find the comment loop for the recent comments in my theme. I too am using the recent comment widget. I looked through functions, comments, sidebar…
“@Jess how can i make the avatars show in the “recent comments” widget? i am using neoclassical theme, i think i need to tweak it myself.
thanks a lot in advance!”
“@explorish Try adding the code get_avatar($comment, 32) inside the comment loop code for the recent comments. Change the 32 to whatever size you would like the avatar to be.”
@Ricky We discovered that the sidebar recent comments loop is part of wordpress core. Since its generally a bad idea to modify the core files, the best solution would be to find a plugin that implements the recent comments feature. Then if that plugin doesn’t support avatars, you could modify the plugin so that it contains the get_avatar() code. I haven’t personally used any recent comments plugins, so I can’t make any good recommendations there, but please let me know if you find one that works.
Thanks Jess. I appreciate your help.
I figured it was in the core. Best not to go tinkering. I will find a recent comments plugin and test it out.
I have your ravatars plugin set up to choose among 48X48 jpegs that I have in the parts folder. I fooled around until I could get just the whole image instead of a cropped part.
This plugin of yours is brilliant, and is the only plugin out there that I know of that can customize default avatars to a blog’s content. I have a medieval blog theme and my custom designed avatars, or should I say ravatars, are all medieval themed as well.
Do you take donations?
@Ricky Its always cool to hear how people are using the plugin and customizing it to fit their needs. Glad you like it!
I do take donations - there is a yellow donation button on this page just before the comments start.
Well, I found a decent “Recent Comments Plugin” for my Wordpress 2.7 here:
http://wordpress.org/extend/plugins/get-recent-comments/
It gives lots of choices. On the setup page there is a list of variables to customize the result:
%comment_excerpt - Shortened comment.
%comment_link - Link to the comment.
%comment_author - Name left by the commenter
%comment_date - Date of comment
%comment_time - Time of comment
%comment_type - Comment, Trackback or Pingback
%time_since - Time since comment was posted
%userid - UserID of the commenter
%gravatar - Gravatar of the commenter, full img tag
%gravatar_url - Gravatar of the commenter, only url
%profile_picture - URL of profile picture
%author_url - URL of author or trackback
%author_url_href - href=”%author_url” or empty
%post_title - Title of the posting
%post_link - Link to the posting
%post_date - Date of the posting
%post_counter - Number of comments to this post
The variable I included was “%gravatar” at the beginning of the “Result” line of code:
%gravatar%comment_author: %comment_excerpt
The appearance is exactly like I want: recent comments in the sidebar but the images are not from my customized ravatars, they are all the default blue gravatar with the white G.
I realize these two plugins are not associated with one another and I don’t know how to put a call in to the ravatars. Seems like it could be complicated. Any ideas, Jess?
@Ricky, Hrmmm It looks like you will need to change the plugin source code. Looking at the recent comments plugin code, go to line 1314 and change $comment_gravatar_url to $ravatar_get($comment->comment_author_email, 50) where 50 is the size you are using for the ravatars. No idea if this will work or not, and I can’t test since the plugin requires an version of wordpress that I don’t use, but its worth a shot.
Jess, I replaced the code, and when I put in the “%gravatar” variable to define the output, I got a fatal error:
“Fatal error: Function name must be a string in /home/outraged/public_html/home/wp-content/plugins/get-recent-comments/get-recent-comments.php on line 1315″
However, thank you for trying to solve my problem of getting Ravatars to show in the recent comments sidebar.
On a more positive note, I can say that Ravatars works great (except for my recent comments issue of not showing the Ravatar) with Wordpress 2.7 and my Wordpress theme veryplaintxt 4.6.1. The recent comments plugin I mentioned in my last post seems to work very well and gives the administrator a host of options over the standard widget.
Thank you for your efforts! I hope a future update may resolve these issues.
Think you could write a “hook” to get the code into the comments loop? The comments loop in the theme I’m using is unfortunately inaccessible, protected by Source Guardian. Thank you for the advice - W
@Ricky I’ll keep this problem in mind. A future update could register a new recent comments sidebar widget. That seems like the cleanest way to get this working. No idea when the new update will come out though….I’m pretty busy with other stuff.
@wwwindi So Ravatars already uses a hook that works with most themes. I’m not sure what the problem could be with your theme without seeing the code. Maybe the theme designer would be able to help?
Thank you for your attention to my previous questions.
Sadly the theme author is unreachable. I still see the ravatar icon in the comments in the admin area, but no ravatars in the test comments I have made. Guess that’s it?
Hola! This is an absolutely fantastic plugin!
However I’m struggling to get it working on the Ninja Kiwi free games blog I have been working on.
As wwwindi reports I see ravatars in admin but not in comments on live site - I’m using the Gravatar option and Ravatar as backup - have tried a bunch of stuff and worked through all the comments above. Nothing sticks yet.
Hope the dev returns shortly.
Testing testing 123…
Thank you for creating this very helpful plugin! I’m having a little bit of trouble getting them to show, though. I’ve created the cache directory and updated the PHP code to not crop like you mentioned above, but I’m still getting the dreaded red X’s for images instead of the actual images I uploaded to the /parts/ directory.
Any ideas?
I’d love to be able to assign ravatar images to specific commenters. Is there a way to do this? Thanks in advance and great plugin!
Sorry there is no way that an administrator can assign a specific ravatar. You can always ask your users to sign up for their own gravatar, and then use ravatars for users that don’t have a gravatar.
This is an awesome plugin that I’ve never seen used before and I’m dying to use it on my site.
The problem is, I keep getting an error on the actual page next to each ravatar that says “Warning: Division by zero in /home8/whatwou8/public_html/wp-content/plugins/ravatar/ravatars.php on line 326″ Does anyone know what that means and how to fix it?
I’m also looking for a recent comments plugin that is compatible with Ravatar. The one Im currently using shows two ravatar images all scrambled up for each commenter.
Thanks!
Hallo,
Vielen Dank für dieses geniale PlugIn. Ich erhalte eine Fehlermeldung wenn ich neue Bilder hochlade:
Warning: imagecopy(): supplied argument is not a valid Image resource in /hp/au/aa/dd/www/hzeit/wp-content/plugins/ravatar/ravatars.php on line 330was kann ich tun um sie zubeheben?
Vielen Dank!
On the line: 448:
return ravatar_show ($comment->comment_author_email) . ” ” . $author;
repleace with
return $author;
why? If in the theme is a get_avatar() function, this will reduplicate avatar, and its’ horrible looks like.
Regards.
Hi!
I figured out how to put the code you gave me into the comments.php and now it works. Thank you for this wonderful plugin and your great support!
Hello
I have a little problem with this great plugin:
in the options page i get no options to set the size, CSS code or anything for the avatars.
I just have the Gravatar support checkboxes, and the Clear Cache button.
I’m using WP 2.8.1, with Ninjamonkey theme (a widget-enabled Hemingway).
In the comments.php file of this theme there’s no get_avatars function, but i tried adding it and got some of the avatars to show, however the options page did not change.
Please help
Thanks
Small update:
I’ve tried using the
ravatar_show($comment->comment_author_email, '160');function, and the avatars show up as black squares.
I’m using PNG’s with transparency, could that be an issue?
In the description you said PNG are supported, and the black squares show up in FF as well as IE
Hi! After your patient help, I have SUCCESS in running ravatars!
A couple of questions left:
1) How can I add borders to my ravatar images?
2) Can you determine what area of the full images in parts are sampled? I would like to (in photoshop) predetermine the size of the images - make them consistent. I would like to do this because I would like most of the image to be visiible, not too cropped and abstract. For example, I have a snowflake image that fills the entire image frame, and I would like to see most of it instead of just a fragment after Ravatars samples the image.
Thanks!!!
I will donate soon -
WWWindi
what if the visitor had set his own gravatar at gravatar.com. i’m testing it
testing icon
I love love love this plugin - it works great. Quick questions, though - how is the ravatar randomly assigned to the email addresses? I have uploaded 34 files, but I only have 28 users right now - but some ravatars are getting assigned twice. Is there a formula to the assignment of pictures? I’d like the images not to repeat until all original 34 are used, if possible.
Also, after I added a few more ravatars to the parts folder, the ravatar assigned to admin posts changed, but the one assigned to my admin comments stayed the same (if you look at my site - I used to have the guy on the motorcycle on all my posts, and he’s still there in my comments, but now my posts show my picture of oranges). I haven’t changed my email address on the admin account, so why would the avatar have changed (and why did it stay the same in the comments)? Just curious!
Again, love this plugin, great job.
Update: the first question about repeated ravatars still stands. But the 2nd question has worked itself out - in a series of cache-empties because of some loading problems, all my ravatars have now changed (though my post ravatar and comment ravatar are still different from each other - is this common/right?)
Wondering if anyone can help. On my site, the ravatars for comments change, but the smaller ravatars for my “most recent registered users” is the same for everyone who registers. Can someone tell me what might be causing this?
Worked like a charm for me. I can’t wait to add my own images. Thanks!
Hi I am trying to use your plug in but keep getting this error:
Warning: imagecopy(): supplied argument is not a valid Image resource in ……..wp-content/plugins/ravatars.php on line 330
The admin panel seems to be functioning properly and I checked the cache images, they exist, but are all black.
I am running WP 2.9
any advice?
Oh, I forgot, this is the page giving me the headache:
http://www.friendsofmofo.com/wp/?p=12&cpage=1#comment-3
Sorry, I am an idiot. Apparently my mistake was that I had unzipped the file but instead of putting the whole ravatar directory in the plug ins folder, I just placed the ravatar.php file and parts directory. After looking at the code, I realized that the images were being generated but the browser was looking for them in the wrong place, so I modified line 402 to:
$url = ‘http://www.friendsofmofo.com/wp/wp-content/plugins/cache’ . “/$seed.png”; and it is working great.
Just wanted to share in case someone comes along with the same problem/mistake.
Great plug in and if it works out I will be happily donating for your work,
all the best,
s.
[...] Ravatars – This plugin will generate a random avatar. It comes with a set of avatars that can be used or you can upload your own. I like the idea of using my own avatars. [...]
I have the same question as wwwindi:
“Can you determine what area of the full images in parts are sampled? I would like to (in photoshop) predetermine the size of the images - make them consistent.”
I finally got the plugin working and made up an icon set in Photoshop with a grid of 80px - 5 rows of 5 - and uploaded this thinking perhaps this would assign each user an icon instead of part of an image. Nope. It just got random parts of the image, instead of picking up an icon, say, 160px over and 240px down.
This is a really great plugin and there’s nothing else like it. (Believe me I’ve looked.) Would be great to somehow get it to work the same as the generated identicons.
I got same question, how can i make the avatars show in the “recent comments” widget?
Hey thanks for a great plugin,
Two Bugs :
1. A line this blog uses Ravatar plugin is displayed at random places on the blog. i am using AutoFocus theme.
2. I am using Buzz Comments plugin to fetch comments from Google BUZZ, for all the comments made using BUZZ, there are two avatars shown, the default BUZZ & RAVATAR too.
Is there a way to show RAVATAR avatar(:D) only if the BUZZ avatar is not available. Just like Gravatar.
Just like Gravatar .
Please add support from Facebook, Twitter & Google Buzz avatars too.
As all of them support importing of comments into wordpress.
Hey Jess, this is a fabulous plugin. Thanks for all the work you’ve put into it. If you’ve got time and energy, it would be brilliant to have an update that can grab avatars from other sources in addition to Gravatar, in case people already have them.
@Kelly and @wwwindi, I think all you have to do is upload your 80×80 jpgs into the image folder (plugins/ravatar/parts). That way you’ll have control over what bits get shown. At least, that seemed to work for me when I tried it.