diff --git a/app/Utils.inc b/app/Utils.inc
index 401fea8c..210af007 100644
--- a/app/Utils.inc
+++ b/app/Utils.inc
@@ -209,6 +209,45 @@
return $mimetype;
}
+
+ /**
+ * Transform an URL to a label.
+ *
+ * @static
+ * @param string $url URL to transform
+ * @return string Resulting Label
+ */
+ public static function urlToLabel($url)
+ {
+ // Parse URL
+ $parts = parse_url($url);
+
+ // Process URL parts
+ if(is_array($parts) && array_key_exists('host', $parts))
+ {
+ // Use only hostname as label
+ $url = $parts['host'];
+ }
+ else
+ {
+ // Strip protocol
+ if(($p = strpos($url, '://')) !== false) {
+ $url = substr($url, $p+3);
+ }
+
+ // Shorten to a specific length
+ $url = substr($url, 0, \nre\configs\AppConfig::$misc['imagesource_length']).'…';
+ }
+
+ // Strip www-prefix
+ if(strpos($url, 'www.') === 0) {
+ $url = substr($url, strlen('www.'));
+ }
+
+
+ return $url;
+ }
+
}
?>
diff --git a/configs/AppConfig.inc b/configs/AppConfig.inc
index cbc7a2f3..21ca643a 100644
--- a/configs/AppConfig.inc
+++ b/configs/AppConfig.inc
@@ -173,7 +173,8 @@
'ranking_range' => 2,
'achievements_range' => 3,
'title_delimiter' => ' – ',
- 'lists_limit' => 10
+ 'lists_limit' => 10,
+ 'imagesource_length' => 30
);
diff --git a/views/html/moodpic/questgroup.tpl b/views/html/moodpic/questgroup.tpl
index 20f91170..091d3b63 100644
--- a/views/html/moodpic/questgroup.tpl
+++ b/views/html/moodpic/questgroup.tpl
@@ -3,7 +3,7 @@
title="=$medium['title']?>" alt="=$medium['description']?>"/>
-
+
=_('Image source')?>:
diff --git a/views/html/moodpic/seminary.tpl b/views/html/moodpic/seminary.tpl
index 20f91170..091d3b63 100644
--- a/views/html/moodpic/seminary.tpl
+++ b/views/html/moodpic/seminary.tpl
@@ -3,7 +3,7 @@
title="=$medium['title']?>" alt="=$medium['description']?>"/>
-
+
=_('Image source')?>: