Created
June 24, 2014 16:24
-
-
Save fwartner/26c3ec4ed04509a299e5 to your computer and use it in GitHub Desktop.
Gravatar Image-Helper for CodeIgniter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); | |
if (!function_exists('get_gravatar')) { | |
function get_gravatar( $email, $s, $d = 'mm', $r = 'g', $img = false, $atts = array() ) { | |
$url = 'http://www.gravatar.com/avatar/'; | |
$url .= md5( strtolower( trim( $email ) ) ); | |
$url .= "?s=$s&d=$d&r=$r"; | |
if ( $img ) { | |
$url = '<img src="' . $url . '"'; | |
foreach ( $atts as $key => $val ) | |
$url .= ' ' . $key . '="' . $val . '"'; | |
$url .= ' />'; | |
} | |
return $url; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment