From 6af4590f01c7ea249c6d03b37fb1001ce96b7f4c Mon Sep 17 00:00:00 2001 From: plegall Date: Wed, 3 Feb 2016 10:21:36 +0100 Subject: fixes #410, add param thumbnail_size to pwg.categories.getList --- include/ws_functions/pwg.categories.php | 9 +++++++-- ws.php | 4 ++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/ws_functions/pwg.categories.php b/include/ws_functions/pwg.categories.php index 5bafaf5da..f55a7a773 100644 --- a/include/ws_functions/pwg.categories.php +++ b/include/ws_functions/pwg.categories.php @@ -181,6 +181,11 @@ function ws_categories_getList($params, &$service) { global $user, $conf; + if (!in_array($params['thumbnail_size'], array_keys(ImageStdParams::get_defined_type_map()))) + { + return new PwgError(WS_ERR_INVALID_PARAM, "Invalid thumbnail_size"); + } + $where = array('1=1'); $join_type = 'INNER'; $join_user = $user['id']; @@ -366,7 +371,7 @@ SELECT id, path, representative_ext, level { if ($row['level'] <= $user['level']) { - $thumbnail_src_of[$row['id']] = DerivativeImage::thumb_url($row); + $thumbnail_src_of[$row['id']] = DerivativeImage::url($params['thumbnail_size'], $row); } else { @@ -411,7 +416,7 @@ SELECT id, path, representative_ext while ($row = pwg_db_fetch_assoc($result)) { - $thumbnail_src_of[ $row['id'] ] = DerivativeImage::thumb_url($row); + $thumbnail_src_of[ $row['id'] ] = DerivativeImage::url($params['thumbnail_size'], $row); } } } diff --git a/ws.php b/ws.php index 66e6a707d..16695b697 100644 --- a/ws.php +++ b/ws.php @@ -193,6 +193,10 @@ function ws_addDefaultMethods( $arr ) 'type'=>WS_TYPE_BOOL), 'fullname' => array('default'=>false, 'type'=>WS_TYPE_BOOL), + 'thumbnail_size' => array( + 'default' => 'thumb', + 'info' => 'square, thumb, 2small, xsmall, small, medium, large, xlarge, xxlarge' + ), ), 'Returns a list of categories.', $ws_functions_root . 'pwg.categories.php' -- cgit v1.2.3