aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/ws_functions.inc.php19
-rw-r--r--ws.php2
2 files changed, 16 insertions, 5 deletions
diff --git a/include/ws_functions.inc.php b/include/ws_functions.inc.php
index 7f0952ec3..199175bb7 100644
--- a/include/ws_functions.inc.php
+++ b/include/ws_functions.inc.php
@@ -1977,11 +1977,22 @@ SELECT *
if (isset($params['tags']) and !empty($params['tags']))
{
$tag_ids = array();
- $tag_names = preg_split('~(?<!\\\),~', $params['tags']);
- foreach ($tag_names as $tag_name)
+ if (is_array($params[tags]))
{
- $tag_id = tag_id_from_tag_name(preg_replace('#\\\\*,#', ',', $tag_name));
- array_push($tag_ids, $tag_id);
+ foreach ($params[tags] as $tag_name)
+ {
+ $tag_id = tag_id_from_tag_name($tag_name);
+ array_push($tag_ids, $tag_id);
+ }
+ }
+ else
+ {
+ $tag_names = preg_split('~(?<!\\\),~', $params['tags']);
+ foreach ($tag_names as $tag_name)
+ {
+ $tag_id = tag_id_from_tag_name(preg_replace('#\\\\*,#', ',', $tag_name));
+ array_push($tag_ids, $tag_id);
+ }
}
add_tags($tag_ids, array($image_id));
diff --git a/ws.php b/ws.php
index 9ebf537dc..61bb01276 100644
--- a/ws.php
+++ b/ws.php
@@ -279,7 +279,7 @@ function ws_addDefaultMethods( $arr )
'default' => 0,
'maxValue' => $conf['available_permission_levels']
),
- 'tags' => array('default' => null),
+ 'tags' => array('default' => null, 'flags' => WS_PARAM_ACCEPT_ARRAY),
'image_id' => array('default' => null),
),
'POST method only.<br>Use the <b>image</b> field for uploading file.<br>Set the form encoding to "form-data"<br><b>category</b> is the numeric identifier of the destination category.<br>You can update an existing photo if you define an existing image_id.'