diff options
author | plegall <plg@piwigo.org> | 2011-12-13 15:00:32 +0000 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2011-12-13 15:00:32 +0000 |
commit | b129ee5c13ce3a24906725f6a2adccd3d8a254c6 (patch) | |
tree | 11c75af71f2f28d95422349e5df3cd77cf119bde /include | |
parent | 5338ef80ef30fced10333868a33718f7d98d9111 (diff) |
merge r12727 from branch 2.3 to trunk
feature 2532 added: pwg.images.add returns image_id (+url)
git-svn-id: http://piwigo.org/svn/trunk@12728 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | include/ws_functions.inc.php | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/include/ws_functions.inc.php b/include/ws_functions.inc.php index 46083d9a7..e1967bcbb 100644 --- a/include/ws_functions.inc.php +++ b/include/ws_functions.inc.php @@ -1767,10 +1767,27 @@ SELECT ); } + $url_params = array('image_id' => $image_id); + // let's add links between the image and the categories if (isset($params['categories'])) { ws_add_image_category_relations($image_id, $params['categories']); + + if (preg_match('/^\d+/', $params['categories'], $matches)) { + $category_id = $matches[0]; + + $query = ' +SELECT id, name, permalink + FROM '.CATEGORIES_TABLE.' + WHERE id = '.$category_id.' +;'; + $result = pwg_query($query); + $category = pwg_db_fetch_assoc($result); + + $url_params['section'] = 'categories'; + $url_params['category'] = $category; + } } // and now, let's create tag associations @@ -1783,6 +1800,11 @@ SELECT } invalidate_user_cache(); + + return array( + 'image_id' => $image_id, + 'url' => make_picture_url($url_params), + ); } function ws_images_addSimple($params, &$service) @@ -3477,4 +3499,4 @@ function ws_extensions_checkupdates($params, &$service) return $result; } -?>
\ No newline at end of file +?> |