I have been very pleased with the Gravatar module but I'm now having issues trying to write modules of my own when Gravatar is installed.

I would like to be able to make a generic Drupal call such as:

$user_image = image_style_url('thumbnail', $user->picture->uri);

But this still returns the Drupal user image, there doesn't seem to be a hook from Gravatar that intercepts this call.

Right now the only way I have found to do this is something such as this:

$uri = module_exists('gravatar') ? _gravatar_get_account_user_picture($user) : $user->picture->uri;

if (file_valid_uri($uri)) {
  $options = array('style_name' => 'thumbnail', 'uri' => $uri, 'alt' => 'Alt');
  $img_html = theme('image_style', $options);
}

I'm sure this will cause problems for other module developers, especially those that don't have the Gravatar module installed and don't foresee this causing others a problem.

Thanks!