Ignore:
Timestamp:
Oct 12, 2011, 8:40:15 PM (9 years ago)
Author:
Dsls
Message:

rotateImage v0.3 :

  • thumbnails are correctly refreshed
  • strengthened ws
  • small tuning on form display
  • it is now possible to select whether HD should be rotated or not
File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/rotateImage/main.inc.php

    r12410 r12417  
    22/*
    33Plugin Name: Rotate Image
    4 Version: 0.2
     4Version: 0.3
    55Description: enables to rotate images in batch processing
    66Plugin URI: http://fr.piwigo.org/ext/extension_view.php?eid=578
     
    1010add_event_handler('loc_begin_element_set_global', 'rotate_image_set_template_data');
    1111add_event_handler('ws_add_methods', 'add_image_rotate_method');
     12add_event_handler('element_set_global_action', 'rotate_image_element_action', 50, 2);
    1213
    1314function add_image_rotate_method($arr)
    1415{
    15   include_once('ws_functions.inc.php');
     16 include_once('ws_functions.inc.php');
    1617}
    1718
    1819function 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(
    2335    'ID' => 'rotateImg',
    2436    'NAME' => l10n('Rotate images'),
    25     'CONTENT' => $template->parse('rotate_image', true),
    26     )
     37    'CONTENT' => $template->parse('rotate_image', true))
    2738  );
    2839}
    2940
    30 
     41function 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}
    3148
    3249?>
Note: See TracChangeset for help on using the changeset viewer.