aboutsummaryrefslogtreecommitdiffstats
path: root/include/ws_functions.inc.php
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2012-02-10 23:48:55 +0000
committerplegall <plg@piwigo.org>2012-02-10 23:48:55 +0000
commit2bfedaea5c401b3878b3d7b71ac51a7d7742e139 (patch)
tree3c9da8add3fa883ee011dbe415fdb26d02940367 /include/ws_functions.inc.php
parent8afb39b1eb1e0269acf70cc921da6c4fc9a42c3c (diff)
feature added: pwg.images.add can perform an update on an existing photo.
git-svn-id: http://piwigo.org/svn/trunk@13090 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/ws_functions.inc.php')
-rw-r--r--include/ws_functions.inc.php20
1 files changed, 19 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']
);