Ignore:
Timestamp:
Oct 12, 2011, 8:40:15 PM (13 years ago)
Author:
Dsls
Message:

rotateImage v0.3 :

  • thumbnails are correctly refreshed
  • strengthened ws
  • small tuning on form display
  • it is now possible to select whether HD should be rotated or not
File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/rotateImage/ws_functions.inc.php

    r12409 r12417  
    99  'image_id'=>array(),
    1010  'angle'=>array('default'=>"90"),
     11  'pwg_token' => array(),
     12  'rotate_hd' => array('default'=>0)
    1113  ),
    1214  'Rotates a given image'
     
    2527  }
    2628
     29  if (empty($params['pwg_token']) or get_pwg_token() != $params['pwg_token'])
     30  {
     31    return new PwgError(403, 'Invalid security token');
     32  }
     33
    2734  include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php');
    2835  include_once(PHPWG_ROOT_PATH.'admin/include/image.class.php');
    2936  $image_id=(int)$params['image_id'];
    3037  $angle=(int)$params['angle'];
     38  $rotate_hd = (int) $params['rotate_hd'];
    3139  $query='
    3240SELECT id, path, tn_ext, has_high
     
    4957  $img->write($image_path);
    5058  update_metadata(array($image_id=>$image_path));
     59  if ($rotate_hd) {
     60    $sizes = array('thumb','high');
     61  } else {
     62    $sizes = array('thumb');
     63  }
    5164 
    52   foreach (array('thumb','high') as $size) {
     65  foreach ($sizes as $size) {
    5366    $resized_path = file_path_for_type($image_path,$size);
    5467    if (file_exists($resized_path)) {
     
    5972  }
    6073  return true;
    61  
    6274}
    6375
Note: See TracChangeset for help on using the changeset viewer.