source: extensions/rotateImage/main.inc.php @ 12570

Last change on this file since 12570 was 12481, checked in by Dsls, 13 years ago

rotateImage v0.4 : removed HD rotation checkbox if library is GD.

File size: 1.6 KB
Line 
1<?php
2/*
3Plugin Name: Rotate Image
4Version: 0.4
5Description: enables to rotate images in batch processing
6Plugin URI: http://fr.piwigo.org/ext/extension_view.php?eid=578
7*/
8if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
9
10add_event_handler('loc_begin_element_set_global', 'rotate_image_set_template_data');
11add_event_handler('ws_add_methods', 'add_image_rotate_method');
12add_event_handler('element_set_global_action', 'rotate_image_element_action', 50, 2);
13
14function add_image_rotate_method($arr)
15{
16 include_once('ws_functions.inc.php');
17}
18
19function rotate_image_set_template_data() {
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    'library' => pwg_image::get_library()
33  ));
34  $template->set_filename('rotate_image', realpath(dirname(__FILE__).'/rotate_image.tpl'));
35  $template->append('element_set_global_plugins_actions', array(
36    'ID' => 'rotateImg',
37    'NAME' => l10n('Rotate images'),
38    'CONTENT' => $template->parse('rotate_image', true))
39  );
40}
41
42function rotate_image_element_action($action, $collection) {
43  global $template;
44  if ($action == 'rotateImg') {
45    //flush thumbnails links by regenerating ramdom ids to uris
46    $template->delete_compiled_templates();
47  }
48}
49
50?>
Note: See TracBrowser for help on using the repository browser.