Changeset 16981 for extensions/rotateImage
- Timestamp:
- Jul 24, 2012, 7:18:01 PM (12 years ago)
- Location:
- extensions/rotateImage
- Files:
-
- 3 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/rotateImage/language/en_UK/plugin.lang.php
r16973 r16981 1 1 <?php 2 $lang['Rotate'] = 'Rotate'; 2 3 $lang['Images rotation in progress...'] = 'Images rotation in progress...'; 3 4 $lang['Rotate images'] = 'Rotate images'; -
extensions/rotateImage/language/fr_FR/plugin.lang.php
r16973 r16981 1 1 <?php 2 $lang['Rotate'] = 'Pivoter'; 2 3 $lang['Images rotation in progress...'] = 'Rotation des images en cours...'; 3 4 $lang['Rotate images'] = 'Pivoter les images'; -
extensions/rotateImage/main.inc.php
r16973 r16981 68 68 return $root_url; 69 69 } 70 71 add_event_handler('tabsheet_before_select','rotate_image_add_tab', 50, 2); 72 function rotate_image_add_tab($sheets, $id) 73 { 74 if ($id == 'photo') 75 { 76 $sheets['rotate'] = array( 77 'caption' => l10n('Rotate'), 78 'url' => get_root_url().'admin.php?page=plugin-rotateImage-'.$_GET['image_id'], 79 ); 80 } 81 82 return $sheets; 83 } 70 84 ?> -
extensions/rotateImage/ws_functions.inc.php
r16973 r16981 2 2 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 3 3 4 include_once(dirname(__FILE__).'/functions.inc.php'); 4 5 5 6 $service = &$arr[0]; … … 28 29 } 29 30 30 if (empty($params['pwg_token']) or get_pwg_token() != $params['pwg_token']) 31 { 32 return new PwgError(403, 'Invalid security token'); 33 } 34 35 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); 36 include_once(PHPWG_ROOT_PATH.'admin/include/image.class.php'); 31 /* if (empty($params['pwg_token']) or get_pwg_token() != $params['pwg_token']) */ 32 /* { */ 33 /* return new PwgError(403, 'Invalid security token'); */ 34 /* } */ 37 35 38 36 $image_id=(int)$params['image_id']; 39 37 40 38 $query=' 41 39 SELECT 42 id, 43 path, 44 representative_ext, 45 rotation 40 id 46 41 FROM '.IMAGES_TABLE.' 47 42 WHERE id = '.$image_id.' … … 53 48 } 54 49 55 $base_angle = pwg_image::get_rotation_angle_from_code($row['rotation']); 56 57 if (get_boolean($params['rotate_hd'])) { 58 if ('auto' == $angle) { 59 $angle = pwg_image::get_rotation_angle($row['path']); 60 $rotation_code = 0; 61 } 62 else { 63 // the angle is based on what the user sees (the thumbnail) and not on 64 // the original, which may have a different angle 65 $angle = ($base_angle + $params['angle']) % 360; 66 67 // the derivatives must not be rotated 68 $rotation_code = 4; 69 } 70 71 if (isset($conf['rotate_image_jpegtran']) and $conf['rotate_image_jpegtran']) { 72 $angle = ($angle + 180) % 360; 73 $command = 'jpegtran -copy all -rotate '.$angle.' -outfile '.$row['path'].' '.$row['path']; 74 exec($command); 75 } 76 else { 77 $image = new pwg_image($row['path']); 78 $image->set_compression_quality(98); 79 $image->rotate($angle); 80 $image->write($row['path']); 81 } 82 83 $conf['use_exif'] = false; 84 $conf['use_iptc'] = false; 85 sync_metadata(array($row['id'])); 86 87 single_update( 88 IMAGES_TABLE, 89 array('rotation' => $rotation_code), 90 array('id' => $row['id']) 91 ); 92 } 93 elseif ('auto' != $params['angle']) { 94 $new_angle = ($base_angle + $params['angle']) % 360; 95 $rotation_code = pwg_image::get_rotation_code_from_angle($new_angle); 96 97 // to show that it's a manual rotation, we use 4,5,6,7 instead of 0,1,2,3 98 $rotation_code+= 4; 99 100 single_update( 101 IMAGES_TABLE, 102 array('rotation' => $rotation_code), 103 array('id' => $row['id']) 104 ); 105 } 106 107 delete_element_derivatives($row); 50 rotate_image($image_id, get_boolean($params['rotate_hd']), $params['angle']); 108 51 109 52 return true;
Note: See TracChangeset
for help on using the changeset viewer.