|
Revision 10382, 1.3 KB
(checked in by patdenice, 2 years ago)
|
|
Don't strip metadata while regenerate websize pictures.
|
| Line | |
|---|
| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
|---|
| 4 | |
|---|
| 5 | global $conf; |
|---|
| 6 | |
|---|
| 7 | $service = &$arr[0]; |
|---|
| 8 | $service->addMethod( |
|---|
| 9 | 'pwg.images.regenerateWebsize', |
|---|
| 10 | 'ws_images_regenerateWebsize', |
|---|
| 11 | array( |
|---|
| 12 | 'image_id' => array(), |
|---|
| 13 | 'maxwidth' => array('default'=>$conf['upload_form_websize_maxwidth']), |
|---|
| 14 | 'maxheight' => array('default'=>$conf['upload_form_websize_maxheight']), |
|---|
| 15 | 'quality' => array('default'=>$conf['upload_form_websize_quality']), |
|---|
| 16 | ), |
|---|
| 17 | 'Regenerate websize images from HD with given arguments.' |
|---|
| 18 | ); |
|---|
| 19 | |
|---|
| 20 | function ws_images_regenerateWebsize($params, &$service) |
|---|
| 21 | { |
|---|
| 22 | global $conf; |
|---|
| 23 | |
|---|
| 24 | if (!is_admin()) |
|---|
| 25 | return new PwgError(401, 'Access denied'); |
|---|
| 26 | |
|---|
| 27 | $query=' |
|---|
| 28 | SELECT id, path, has_high, width, height |
|---|
| 29 | FROM '.IMAGES_TABLE.' |
|---|
| 30 | WHERE id = '.(int)$params['image_id'].' |
|---|
| 31 | ;'; |
|---|
| 32 | |
|---|
| 33 | $image = pwg_db_fetch_assoc(pwg_query($query)); |
|---|
| 34 | if ($image == null) |
|---|
| 35 | return new PwgError(404, "image_id not found"); |
|---|
| 36 | |
|---|
| 37 | include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php'); |
|---|
| 38 | |
|---|
| 39 | if (!empty( $image['has_high'] )) |
|---|
| 40 | { |
|---|
| 41 | trigger_event( |
|---|
| 42 | 'upload_image_resize', |
|---|
| 43 | false, |
|---|
| 44 | file_path_for_type($image['path'], 'high'), |
|---|
| 45 | $image['path'], |
|---|
| 46 | $params['maxwidth'], |
|---|
| 47 | $params['maxheight'], |
|---|
| 48 | $params['quality'], |
|---|
| 49 | false |
|---|
| 50 | ); |
|---|
| 51 | |
|---|
| 52 | return true; |
|---|
| 53 | } |
|---|
| 54 | |
|---|
| 55 | return false; |
|---|
| 56 | } |
|---|
| 57 | |
|---|
| 58 | ?> |
|---|