Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // If you'd like to implement Gravatar on your site and want a simple function to use,
- // feel free to use this function I made for some of my sites.
- // Example - Default settings:
- // <img src="<?php echo gravatarURL($userEmail); ?>" />
- // Example - Custom size, default image, and rating:
- // <img src="<?php echo gravatarURL($userEmail, 100, 'http://some-site.com/images/default_user.png', 'g'); ?>" />
- function gravatarURL($email, $size = 80, $defaultImage = "identicon", $rating = "pg") {
- $emailHash = md5(strtolower(trim($email)));
- $url = "http://gravatar.com/avatar/{$emailHash}?s=$size&d=$defaultImage&r=$rating";
- return $url;
- }
Advertisement
Add Comment
Please, Sign In to add comment