Getting default user picture drupal 6 Hi I got neat facebook style chat called arrowchat for my drupal website, however the script was lacking user picture integration. I managed to get user pictures but if user didn't set picture and is using default picture I'm getting broken image and 404 not found in logs. I've tried to fetch gravatar for users without picture set but couldn't make it work..

/**
 * This function returns the URL of the avatar of the specified user ID.
 *
 * @param userid the user ID of the user
 * @param image if the image includes more than just a user ID, this param is passed
 * in from the avatar row in the buddylist and get user details functions.
 * @return the link of the user ID's profile
 */
function get_avatar($image, $user_id, $account) 
{
               return "http://mypage.com/files/pictures/picture-" . ($user_id) . ".jpg";

    if (empty($account-&gt;picture)) {
    return "http://www.gravatar.com/avfatar/" . md5($image) . "?d=identicon";
     }
}
There is already a Gravatar module out there. I think you would be better off using a vetted, bug tested code than having to build it yourself. Once you have it installed, you can use the function gravatar_get_gravatar($mail, $options = array()) to do exactly what you're wanting.