From: Christian Weiske Date: Tue, 17 Apr 2012 08:19:46 +0000 (+0200) Subject: use anonymous image X-Git-Tag: v0.1.0~26 X-Git-Url: https://git.cweiske.de/phorkie.git/commitdiff_plain/992170d966b238ce17504f1c347a501d46d50082 use anonymous image --- diff --git a/src/phorkie/Repository/Commit.php b/src/phorkie/Repository/Commit.php index ec4a04a..ce00235 100644 --- a/src/phorkie/Repository/Commit.php +++ b/src/phorkie/Repository/Commit.php @@ -20,7 +20,13 @@ class Repository_Commit require_once 'PEAR/Services/Libravatar.php'; $s = new \Services_Libravatar(); - return $s->url('cweiske@cweiske.de'/*$this->committerEmail*/, array('s' => 32)); + return $s->url( + $this->committerEmail, + array( + 'size' => 32, + 'default' => Tools::fullUrl('/phorkie/anonymous.png') + ) + ); } /** diff --git a/src/phorkie/Tools.php b/src/phorkie/Tools.php index c6e4db5..d9b7637 100644 --- a/src/phorkie/Tools.php +++ b/src/phorkie/Tools.php @@ -21,6 +21,22 @@ class Tools return rmdir($path); } + /** + * Create a full URL with protocol and host name + * + * @param string $path Path to the file, with leading / + * + * @return string Full URL + */ + public static function fullUrl($path) + { + if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']) { + $prot = 'https'; + } else { + $prot = 'http'; + } + return $prot . '://' . $_SERVER['HTTP_HOST'] . $path; + } } ?> \ No newline at end of file diff --git a/www/phorkie/anonymous.png b/www/phorkie/anonymous.png new file mode 100644 index 0000000..b218029 Binary files /dev/null and b/www/phorkie/anonymous.png differ