Part of #35: show paste owner
[phorkie.git] / src / phorkie / HtmlHelper.php
index ea21ab59cafa6706f37387543cbd4143535569cc..fd04d831e217cb74f931e97f1ffacfff98a27104 100644 (file)
@@ -3,6 +3,22 @@ namespace phorkie;
 
 class HtmlHelper
 {
 
 class HtmlHelper
 {
+    public function getIconUrl($email, $size = 32)
+    {
+        if ($email == 'anonymous@phorkie') {
+            return '/phorkie/anonymous.png';
+        }
+
+        $s = new \Services_Libravatar();
+        return $s->url(
+            $email,
+            array(
+                'size'    => $size,
+                'default' => Tools::fullUrl('/phorkie/anonymous.png')
+            )
+        );
+    }
+
     public function getLanguageOptions(File $file = null)
     {
         $html = '<option value="_auto_">* automatic *</option>';
     public function getLanguageOptions(File $file = null)
     {
         $html = '<option value="_auto_">* automatic *</option>';