Last change
on this file since 21227 was
16981,
checked in by plg, 12 years ago
|
Insert a new tab "Rotate" on the photo administration screen (requires Piwigo 2.4.2)
|
File size:
1.1 KB
|
Line | |
---|
1 | <?php |
---|
2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
3 | |
---|
4 | include_once(dirname(__FILE__).'/functions.inc.php'); |
---|
5 | |
---|
6 | $service = &$arr[0]; |
---|
7 | $service->addMethod('pwg.image.rotate', 'ws_image_rotate', |
---|
8 | array( |
---|
9 | 'image_id'=>array(), |
---|
10 | 'angle'=>array('default'=>"90"), |
---|
11 | 'pwg_token' => array(), |
---|
12 | 'rotate_hd' => array('default'=>0) |
---|
13 | ), |
---|
14 | 'Rotates a given image' |
---|
15 | ); |
---|
16 | |
---|
17 | function ws_image_rotate($params, &$service) |
---|
18 | { |
---|
19 | global $conf; |
---|
20 | |
---|
21 | if (!is_admin()) |
---|
22 | { |
---|
23 | return new PwgError(401, 'Access denied'); |
---|
24 | } |
---|
25 | |
---|
26 | if (empty($params['image_id'])) |
---|
27 | { |
---|
28 | return new PwgError(403, "image_id or image_path is missing"); |
---|
29 | } |
---|
30 | |
---|
31 | /* if (empty($params['pwg_token']) or get_pwg_token() != $params['pwg_token']) */ |
---|
32 | /* { */ |
---|
33 | /* return new PwgError(403, 'Invalid security token'); */ |
---|
34 | /* } */ |
---|
35 | |
---|
36 | $image_id=(int)$params['image_id']; |
---|
37 | |
---|
38 | $query=' |
---|
39 | SELECT |
---|
40 | id |
---|
41 | FROM '.IMAGES_TABLE.' |
---|
42 | WHERE id = '.$image_id.' |
---|
43 | ;'; |
---|
44 | $row = pwg_db_fetch_assoc(pwg_query($query)); |
---|
45 | if ($row == null) |
---|
46 | { |
---|
47 | return new PwgError(403, "image_id not found"); |
---|
48 | } |
---|
49 | |
---|
50 | rotate_image($image_id, get_boolean($params['rotate_hd']), $params['angle']); |
---|
51 | |
---|
52 | return true; |
---|
53 | } |
---|
54 | |
---|
55 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.