aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/ws_functions.inc.php20
-rw-r--r--ws.php1
2 files changed, 20 insertions, 1 deletions
diff --git a/include/ws_functions.inc.php b/include/ws_functions.inc.php
index fa4fd5fb0..4eb3fb3ce 100644
--- a/include/ws_functions.inc.php
+++ b/include/ws_functions.inc.php
@@ -1745,6 +1745,24 @@ function ws_images_add($params, &$service)
);
}
+ $params['image_id'] = (int)$params['image_id'];
+ if ($params['image_id'] > 0)
+ {
+ include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
+
+ $query='
+SELECT *
+ FROM '.IMAGES_TABLE.'
+ WHERE id = '.$params['image_id'].'
+;';
+
+ $image_row = pwg_db_fetch_assoc(pwg_query($query));
+ if ($image_row == null)
+ {
+ return new PwgError(404, "image_id not found");
+ }
+ }
+
// does the image already exists ?
if ($params['check_uniqueness'])
{
@@ -1797,7 +1815,7 @@ SELECT
$params['original_filename'],
null, // categories
isset($params['level']) ? $params['level'] : null,
- null, // image_id
+ $params['image_id'] > 0 ? $params['image_id'] : null,
$params['original_sum']
);
diff --git a/ws.php b/ws.php
index 53ba4ab83..45e4ae76d 100644
--- a/ws.php
+++ b/ws.php
@@ -260,6 +260,7 @@ function ws_addDefaultMethods( $arr )
'maxValue' => $conf['available_permission_levels']
),
'check_uniqueness' => array('default' => true),
+ 'image_id' => array('default' => null),
),
'POST method only.
<br><b>categories</b> is a string list "category_id[,rank];category_id[,rank]" The rank is optional and is equivalent to "auto" if not given.'