Created
March 19, 2018 17:15
-
-
Save gabrielfroes/a67efb28fbf174db60f7861d989830e5 to your computer and use it in GitHub Desktop.
PHP client library for Gravatar
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 | |
/*----------------------------------------------------------------------------- | |
* PHP client library for Gravatar | |
* | |
* Author: Gabriel Froes | |
* Copyright: (c) 2018 RW Studio | |
* License: BSD 3-Clause License | |
* See accompanying LICENSE file | |
* | |
* Version: 1.0 | |
* Updated: - | |
*----------------------------------------------------------------------------- | |
*/ | |
class gravatar { | |
private $_version = '1.0'; | |
private $_url = 'https://www.gravatar.com/avatar/'; | |
private $_size = 40; | |
private $_default; | |
public function __construct($params) { | |
$this->_default = $params['default']; | |
$this->_size = $params['size']; | |
} | |
public function version() { | |
return $this->_version; | |
} | |
// Return gravatar image src | |
public function get_gravatar($email) { | |
$img = $this->_url . md5( strtolower( trim( $email ) ) ) . "?d=" . urlencode( $this->_default ) . "&s=" . $this->_size; | |
return $img; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment