Changeset 12417 for extensions
- Timestamp:
- Oct 12, 2011, 8:40:15 PM (13 years ago)
- Location:
- extensions/rotateImage
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/rotateImage/language/fr_FR/plugin.lang.php
r12409 r12417 2 2 $lang['Images rotation in progress...'] = 'Rotation des images en cours...'; 3 3 $lang['Rotate images'] = 'Pivoter les images'; 4 $lang['Rotate 90° right'] = 'Rotation de 90° à droite'; 5 $lang['Rotate 90° left'] = 'Rotation de 90° à gauche'; 6 $lang['Rotate 180°'] = 'Rotation de 180°'; 7 4 $lang['Angle'] = 'Angle'; 5 $lang['Also rotate HD image'] = 'Pivoter aussi l\'image HD'; 6 $lang['90° right'] = '90° à droite'; 7 $lang['90° left'] = '90° à gauche'; 8 $lang['180°'] = '180°'; 8 9 ?> -
extensions/rotateImage/main.inc.php
r12410 r12417 2 2 /* 3 3 Plugin Name: Rotate Image 4 Version: 0. 24 Version: 0.3 5 5 Description: enables to rotate images in batch processing 6 6 Plugin URI: http://fr.piwigo.org/ext/extension_view.php?eid=578 … … 10 10 add_event_handler('loc_begin_element_set_global', 'rotate_image_set_template_data'); 11 11 add_event_handler('ws_add_methods', 'add_image_rotate_method'); 12 add_event_handler('element_set_global_action', 'rotate_image_element_action', 50, 2); 12 13 13 14 function add_image_rotate_method($arr) 14 15 { 15 16 include_once('ws_functions.inc.php'); 16 17 } 17 18 18 19 function rotate_image_set_template_data() { 19 global $template,$lang; 20 load_language('plugin.lang', dirname(__FILE__).'/'); 21 $template->set_filename('rotate_image', realpath(dirname(__FILE__).'/rotate_image.tpl')); 22 $template->append('element_set_global_plugins_actions', array( 20 global $template,$lang; 21 load_language('plugin.lang', dirname(__FILE__).'/'); 22 $angles = array ( 23 array('value' => 90, 'name' => l10n('90° left')), 24 array('value' => 270, 'name' => l10n('90° right')), 25 array('value' => 180, 'name' => l10n('180°')) 26 ); 27 28 $template->assign(array( 29 'RI_PWG_TOKEN' => get_pwg_token(), 30 'angles' => $angles, 31 'angle_value' => 90 32 )); 33 $template->set_filename('rotate_image', realpath(dirname(__FILE__).'/rotate_image.tpl')); 34 $template->append('element_set_global_plugins_actions', array( 23 35 'ID' => 'rotateImg', 24 36 'NAME' => l10n('Rotate images'), 25 'CONTENT' => $template->parse('rotate_image', true), 26 ) 37 'CONTENT' => $template->parse('rotate_image', true)) 27 38 ); 28 39 } 29 40 30 41 function rotate_image_element_action($action, $collection) { 42 global $template; 43 if ($action == 'rotateImg') { 44 //flush thumbnails links by regenerating ramdom ids to uris 45 $template->delete_compiled_templates(); 46 } 47 } 31 48 32 49 ?> -
extensions/rotateImage/rotate_image.tpl
r12409 r12417 1 {footer_script}1 {footer_script} 2 2 var rotateImagesMessage = "{'Images rotation in progress...'|@translate}"; 3 3 var ri_pwg_token = '{$RI_PWG_TOKEN}'; 4 4 {literal} 5 5 jQuery('#applyAction').click(function(e) { … … 10 10 else if (jQuery('[name="selectAction"]').val() == 'rotateImg') 11 11 { 12 angle = jQuery(' input[name="rotate_angle"]:checked').val();12 angle = jQuery('select[name="rotate_angle"]').val(); 13 13 e.stopPropagation(); 14 14 } … … 55 55 format: 'json', 56 56 angle: angle, 57 pwg_token: ri_pwg_token, 57 58 image_id: elements[i] 58 59 }, … … 68 69 69 70 <div id="rotate_image" class="bulkAction"> 70 <p>{'Select angle :'|@translate}</p> 71 <label><input type="radio" name="rotate_angle" value="90" checked="checked"> {'Rotate 90° left'|@translate}</label> 72 <label><input type="radio" name="rotate_angle" value="270"> {'Rotate 90° right'|@translate}</label> 73 <label><input type="radio" name="rotate_angle" value="180"> {'Rotate 180°'|@translate}</label> 71 <table style="margin-left:20px;"> 72 <tr> 73 <th id="thumb_width_th">{'Angle'|@translate}</th> 74 <td> 75 <select name="rotate_angle"> 76 {foreach from=$angles item=angle} 77 <option value="{$angle.value}" {if $saved_angle eq $angle.value}selected="selected"{/if}>{$angle.name}</option> 78 {/foreach} 79 </select> 80 </td> 81 </tr> 82 <tr> 83 <th><label for="rotate_hd">{'Also rotate HD image'|@translate}</label></th> 84 <td><input type="checkbox" name="rotate_hd" id="rotate_hd" {if $upload_form_settings.thumb_crop}checked="checked"{/if}></td> 85 </tr> 86 </table> 74 87 </div> -
extensions/rotateImage/ws_functions.inc.php
r12409 r12417 9 9 'image_id'=>array(), 10 10 'angle'=>array('default'=>"90"), 11 'pwg_token' => array(), 12 'rotate_hd' => array('default'=>0) 11 13 ), 12 14 'Rotates a given image' … … 25 27 } 26 28 29 if (empty($params['pwg_token']) or get_pwg_token() != $params['pwg_token']) 30 { 31 return new PwgError(403, 'Invalid security token'); 32 } 33 27 34 include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php'); 28 35 include_once(PHPWG_ROOT_PATH.'admin/include/image.class.php'); 29 36 $image_id=(int)$params['image_id']; 30 37 $angle=(int)$params['angle']; 38 $rotate_hd = (int) $params['rotate_hd']; 31 39 $query=' 32 40 SELECT id, path, tn_ext, has_high … … 49 57 $img->write($image_path); 50 58 update_metadata(array($image_id=>$image_path)); 59 if ($rotate_hd) { 60 $sizes = array('thumb','high'); 61 } else { 62 $sizes = array('thumb'); 63 } 51 64 52 foreach ( array('thumb','high')as $size) {65 foreach ($sizes as $size) { 53 66 $resized_path = file_path_for_type($image_path,$size); 54 67 if (file_exists($resized_path)) { … … 59 72 } 60 73 return true; 61 62 74 } 63 75
Note: See TracChangeset
for help on using the changeset viewer.