Fetch Gravatar Image

Get a Gravatar for email address. 

    /**
     * Get a Gravatar for email.
     *
     * @param string $email      The email address
     * @param int    $size       Size in pixels, defaults to 80 (in px), available values from 1 to 2048
     * @param string $default    Default imageset to use, available values: 404, mm, identicon, monsterid, wavatar
     * @param string $rating     Maximum rating (inclusive), available values:  g, pg, r, x
     *
     * @return string containing complete image tag
     */
    public static function getGravatar($email, $size = 80, $default = 'mm', $rating = 'g')
    {
         $url = 'https://secure.gravatar.com/';

        return '<img src="' . $url . 'avatar.php?gravatar_id=' . md5(strtolower(trim($email))) . '&default=' . $default . '&size=' . $size . '&rating=' . $rating . '" width="' . $size . 'px" height="' . $size . 'px" />';

    }

Loading ...

Related Results :

  1. Fetch Gravatar Image
Note :
  • Related Posts are generally User Blog posts.
  • or Other tutorials from other networks of w3clan.com.
  • Any registered user can create related posts based on search term tags.

About the Author