Gravatar Helper functions to utilize with CodeIgniter 2.x and 3.x or Standard PHP Application.
- Copy
gravatar_helper.php
to yourapplication/helpers
folder. - Autoload the helper in
application/config/autoload.php
: $autoload['helper'] = array('gravatar'); - Use helper functions as needed.
/**
* Get either a Gravatar URL or complete image tag for a specified email address.
*
* @param string $email The email address
* @param int $s Size in pixels, defaults to 80px [ 1 - 2048 ]
* @param string $d Default imageset to use [ 404 | mm | identicon | monsterid | wavatar ]
* @param string $r Maximum rating (inclusive) [ g | pg | r | x ]
* @param bool $img True to return a complete IMG tag False for just the URL
* @param array $atts Optional, additional key/value attributes to include in the IMG tag
* @return String containing either just a URL or a complete image tag
*/
<?php echo get_gravatar( '[email protected]', 180 )?>
© 2016 Omkar Tapale. All Rights Reserved.
Released under the MIT License: https://www.opensource.org/licenses/mit-license.php