Changeset 9934


Ignore:
Timestamp:
Mar 30, 2011, 10:54:23 AM (10 years ago)
Author:
patdenice
Message:

Move ws function in separate file.

Location:
extensions/regenerateThumbnails
Files:
1 added
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/regenerateThumbnails/element_set_global_action.tpl

    r9931 r9934  
    11{combine_script id='jquery.progressBar' path='plugins/regenerateThumbnails/js/jquery.progressbar.min.js' load='footer'}
    2 {combine_script id='jquery.ajaxmanager' path='plugins/regenerateThumbnails/js/jquery.ajaxmanager.js' load='footer'}
     2{combine_script id='jquery.ajaxmanager' path='themes/default/js/plugins/jquery.ajaxmanager.js' load='footer'}
    33
    44{footer_script require='jquery.progressBar,jquery.ajaxmanager'}
  • extensions/regenerateThumbnails/main.inc.php

    r9931 r9934  
    4343function add_regenerate_thumbnails_method($arr)
    4444{
    45   global $conf;
    46 
    47   $service = &$arr[0];
    48   $service->addMethod(
    49     'pwg.images.regenerateThumbnail',
    50     'ws_images_regenerateThumbnail',
    51     array(
    52       'image_id'  => array(),
    53       'maxwidth'  => array('default'=>$conf['upload_form_thumb_maxwidth']),
    54       'maxheight' => array('default'=>$conf['upload_form_thumb_maxheight']),
    55       'quality'   => array('default'=>$conf['upload_form_thumb_quality']),
    56       'square'    => array('default'=>@$conf['upload_form_thumb_square']),
    57     ),
    58     'Regenerate a thumbnail with given arguments.'
    59   );
    60 }
    61 
    62 function ws_images_regenerateThumbnail($params, &$service)
    63 {
    64   global $conf;
    65 
    66   if (!is_admin())
    67     return new PwgError(401, 'Access denied');
    68 
    69   $query='
    70 SELECT id, path
    71 FROM '.IMAGES_TABLE.'
    72 WHERE id = '.(int)$params['image_id'].'
    73 ;';
    74 
    75   $image = pwg_db_fetch_assoc(pwg_query($query));
    76   if ($image == null)
    77     return new PwgError(404, "image_id not found");
    78 
    79   include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php');
    80 
    81   if ($params['square'] == 'true' or $params['square'] == 'false')
    82     $params['square'] = get_boolean($params['square']);
    83   if (!$params['square'])
    84     remove_event_handler('upload_thumbnail_resize', 'upload_square_resize', 40);
    85  
    86   trigger_event(
    87     'upload_thumbnail_resize',
    88     false,
    89     $image['path'],
    90     file_path_for_type($image['path'], 'thumb'),
    91     $params['maxwidth'],
    92     $params['maxheight'],
    93     $params['quality'],
    94     true
    95     );
    96 
    97   return true;
     45  include_once(REGENERATE_THUMBNAILS_PATH.'ws_functions.inc.php');
    9846}
    9947
Note: See TracChangeset for help on using the changeset viewer.