From ea6df9cc67cb2016963be5602a9d54093853da59 Mon Sep 17 00:00:00 2001 From: Omkar T Date: Tue, 2 Feb 2016 02:46:54 +0530 Subject: [PATCH] Added get_gravatar function and README file --- README.md | 42 +++++++++++++++++++++++++++++++ helpers/gravatar_helper.php | 50 +++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 README.md create mode 100644 helpers/gravatar_helper.php diff --git a/README.md b/README.md new file mode 100644 index 0000000..575bddb --- /dev/null +++ b/README.md @@ -0,0 +1,42 @@ + +Gravatar Helper Spark for CodeIgniter +============================ + +[Gravatar](http://gravatar.com) Helper functions to utilize with [CodeIgniter](http://codeigniter.com) 2.x and 3.x or Standard PHP Application. + + +Usage +------------------------------------- + +1. Copy `gravatar_helper.php` to your `application/helpers` folder. +2. Autoload the helper in `application/config/autoload.php`: $autoload['helper'] = array('gravatar'); +3. Use helper functions as needed. + + +Examples +------------------------------------- + + /** + * 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 + */ + + + + +License +------------------------------------- + +© 2016 Omkar Tapale. All Rights Reserved. + +Released under the MIT License: [http://www.opensource.org/licenses/mit-license.php](http://www.opensource.org/licenses/mit-license.php) + + + diff --git a/helpers/gravatar_helper.php b/helpers/gravatar_helper.php new file mode 100644 index 0000000..de0f7d1 --- /dev/null +++ b/helpers/gravatar_helper.php @@ -0,0 +1,50 @@ + $val ) + $url .= ' ' . $key . '="' . $val . '"'; + $url .= ' />'; + } + return $url; + } +} \ No newline at end of file