Changeset 16973 for extensions/rotateImage/main.inc.php
- Timestamp:
- Jul 24, 2012, 3:38:35 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/rotateImage/main.inc.php
r13524 r16973 2 2 /* 3 3 Plugin Name: Rotate Image 4 Version: 0.64 Version: auto 5 5 Description: enables to rotate images in batch processing 6 6 Plugin URI: http://fr.piwigo.org/ext/extension_view.php?eid=578 … … 8 8 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 9 9 10 add_event_handler('loc_begin_element_set_global', 'rotate_image_set_template_data');11 10 add_event_handler('ws_add_methods', 'add_image_rotate_method'); 12 add_event_handler('element_set_global_action', 'rotate_image_element_action', 50, 2);13 14 11 function add_image_rotate_method($arr) 15 12 { … … 17 14 } 18 15 16 add_event_handler('loc_begin_element_set_global', 'rotate_image_set_template_data'); 19 17 function rotate_image_set_template_data() { 20 18 global $template,$lang; 21 19 load_language('plugin.lang', dirname(__FILE__).'/'); 20 21 include_once(PHPWG_ROOT_PATH.'admin/include/image.class.php'); 22 22 23 $angles = array ( 23 array('value' => 90, 'name' => l10n('90° left')),24 24 array('value' => 270, 'name' => l10n('90° right')), 25 array('value' => 90, 'name' => l10n('90° left')), 25 26 array('value' => 180, 'name' => l10n('180°')) 26 27 ); … … 40 41 } 41 42 43 add_event_handler('element_set_global_action', 'rotate_image_element_action', 50, 2); 42 44 function rotate_image_element_action($action, $collection) { 43 global $template;44 45 if ($action == 'rotateImg') { 45 //flush thumbnails links by regenerating ramdom ids to uris 46 $template->delete_compiled_templates(); 46 add_event_handler('get_derivative_url', 'rotate_image_force_refresh', EVENT_HANDLER_PRIORITY_NEUTRAL, 4); 47 47 } 48 48 } 49 49 50 function rotate_image_force_refresh($root_url, $params, $src_image, $rel_url) 51 { 52 global $collection; 53 54 if (in_array($src_image->id, $collection)) 55 { 56 if (strpos($root_url, '?') === false) 57 { 58 $root_url.= '?'; 59 } 60 else 61 { 62 $root_url.= '&'; 63 } 64 65 $root_url.= 'rand='.md5(uniqid(rand(), true)); 66 } 67 68 return $root_url; 69 } 50 70 ?>
Note: See TracChangeset
for help on using the changeset viewer.