[12409] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | Plugin Name: Rotate Image |
---|
[12417] | 4 | Version: 0.3 |
---|
[12409] | 5 | Description: enables to rotate images in batch processing |
---|
[12410] | 6 | Plugin URI: http://fr.piwigo.org/ext/extension_view.php?eid=578 |
---|
[12409] | 7 | */ |
---|
| 8 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 9 | |
---|
| 10 | add_event_handler('loc_begin_element_set_global', 'rotate_image_set_template_data'); |
---|
| 11 | add_event_handler('ws_add_methods', 'add_image_rotate_method'); |
---|
[12417] | 12 | add_event_handler('element_set_global_action', 'rotate_image_element_action', 50, 2); |
---|
[12409] | 13 | |
---|
| 14 | function add_image_rotate_method($arr) |
---|
| 15 | { |
---|
[12417] | 16 | include_once('ws_functions.inc.php'); |
---|
[12409] | 17 | } |
---|
| 18 | |
---|
| 19 | function rotate_image_set_template_data() { |
---|
[12417] | 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( |
---|
[12409] | 35 | 'ID' => 'rotateImg', |
---|
| 36 | 'NAME' => l10n('Rotate images'), |
---|
[12417] | 37 | 'CONTENT' => $template->parse('rotate_image', true)) |
---|
[12409] | 38 | ); |
---|
| 39 | } |
---|
| 40 | |
---|
[12417] | 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 | } |
---|
[12409] | 48 | |
---|
| 49 | ?> |
---|