use anonymous image
authorChristian Weiske <cweiske@cweiske.de>
Tue, 17 Apr 2012 08:19:46 +0000 (10:19 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Tue, 17 Apr 2012 08:19:46 +0000 (10:19 +0200)
src/phorkie/Repository/Commit.php
src/phorkie/Tools.php
www/phorkie/anonymous.png [new file with mode: 0644]

index ec4a04a..ce00235 100644 (file)
@@ -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')
+            )
+        );
     }
 
     /**
index c6e4db5..d9b7637 100644 (file)
@@ -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 (file)
index 0000000..b218029
Binary files /dev/null and b/www/phorkie/anonymous.png differ