fixes #410, add param thumbnail_size to pwg.categories.getList

This commit is contained in:
plegall 2016-02-03 10:21:36 +01:00
parent c4b7977a42
commit 6af4590f01
2 changed files with 11 additions and 2 deletions

View file

@ -181,6 +181,11 @@ function ws_categories_getList($params, &$service)
{ {
global $user, $conf; 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'); $where = array('1=1');
$join_type = 'INNER'; $join_type = 'INNER';
$join_user = $user['id']; $join_user = $user['id'];
@ -366,7 +371,7 @@ SELECT id, path, representative_ext, level
{ {
if ($row['level'] <= $user['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 else
{ {
@ -411,7 +416,7 @@ SELECT id, path, representative_ext
while ($row = pwg_db_fetch_assoc($result)) 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);
} }
} }
} }

4
ws.php
View file

@ -193,6 +193,10 @@ function ws_addDefaultMethods( $arr )
'type'=>WS_TYPE_BOOL), 'type'=>WS_TYPE_BOOL),
'fullname' => array('default'=>false, 'fullname' => array('default'=>false,
'type'=>WS_TYPE_BOOL), 'type'=>WS_TYPE_BOOL),
'thumbnail_size' => array(
'default' => 'thumb',
'info' => 'square, thumb, 2small, xsmall, small, medium, large, xlarge, xxlarge'
),
), ),
'Returns a list of categories.', 'Returns a list of categories.',
$ws_functions_root . 'pwg.categories.php' $ws_functions_root . 'pwg.categories.php'