Add getImageUrl in API to get user picture url
authorDuck (Jakob Munih) <duck@obala.net>
Sun, 8 Mar 2009 11:37:48 +0000 (12:37 +0100)
committerDuck (Jakob Munih) <duck@obala.net>
Sun, 8 Mar 2009 11:39:21 +0000 (12:39 +0100)
folks/lib/api.php

index ce5c99c..e88187e 100644 (file)
@@ -106,6 +106,13 @@ $_services['addUser'] = array(
     'args' => array('userId' => 'string')
 );
 
+$_services['getImageUrl'] = array(
+    'args' => array('user'        => 'string',
+                    'view'       => 'string',
+                    'full'       => 'boolean'),
+    'type' => 'string'
+);
+
 if (Auth::isAdmin()) {
     $_services['userList'] = array(
         'type' => '{urn:horde}stringArray'
@@ -117,6 +124,22 @@ if (Auth::isAdmin()) {
 }
 
 /**
+ * Returns profile image URL.
+ *
+ * @param string  $user      User uid
+ * @param string $view       The view ('small', 'big') to show.
+ * @param boolean $full      Return a path that includes the server name?
+ *
+ * @return string  The image path.
+ */
+function _folks_getImageUrl($user, $view = 'small', $full = false)
+{
+    require_once dirname(__FILE__) . '/base.php';
+
+    return Folks::getImageUrl($user, $view, $full);
+}
+
+/**
  * Callback for comment API.
  *
  * @param int $id       Internal data identifier.