A Gravatar is a remote avatar that's popular among blogs because it is centralized in one location. However, bandwidth is expensive and remote images take additional time to download. Why not cache them instead?
View Gravatar Cacher source or view the demo
allow_url_fopen in php.iniThe cached images are good for 24 hours. If GD is available, the fullsized image will be cached without borders, and then be resized and have borders applied on the fly (this can be disabled). Your Gravatar's requested size will automatically be set to the dimensions of your default image (eg if default.png is 60x60, requesting cache.php?gravatar_id=279aa12c3326f87c460aa4f31d18a065 will also be 60x60).
Gravatar.com removed every possible way of automaticly detecting avatar not found without actually downloading and processing the image. If your desired dimensions are smaller than 80x80 and you're unable to use the GD options, you'll need to change the value of DEFAULT_GRAVATAR_MD5 to be the result of md5_file() on a default image from gravatar.com in your desired dimensions. You can get the md5 for your desired size on the demo.
Only the cache directory needs to be writable. The local directory is for containing any avatars you wish to use instead of what's on gravatar.com. This allows registered users for your site to have their own special avatar without registering with gravatar.com.
This script can be chained together with any script that uses similar GET arguments. You'll need to modify $this->gravatars in the constructor to add to the array of sites to use.