Changeset 13319


Ignore:
Timestamp:
Feb 23, 2012, 3:25:41 PM (9 years ago)
Author:
plg
Message:

new option to compute rotation angle from EXIF orientation tag

Location:
extensions/rotateImage
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/rotateImage/language/en_UK/plugin.lang.php

    r12481 r13319  
    77$lang['90° left'] = '90° left';
    88$lang['180°'] = '180°';
     9$lang['auto (EXIF orientation tag)'] = 'auto (EXIF orientation tag)';
    910?>
  • extensions/rotateImage/language/fr_FR/plugin.lang.php

    r12417 r13319  
    77$lang['90° left'] = '90° à gauche';
    88$lang['180°'] = '180°';
     9$lang['auto (EXIF orientation tag)'] = 'automatique (selon le tag d\'orientation EXIF)';
    910?>
  • extensions/rotateImage/rotate_image.tpl

    r13314 r13319  
    11{footer_script}
    22var rotateImagesMessage = "{'Images rotation in progress...'|@translate}";
     3var autoRotateOptionText = "{'auto (EXIF orientation tag)'|@translate}";
    34var ri_pwg_token = '{$RI_PWG_TOKEN}';
    45{literal}
     6jQuery(document).ready(function() {
     7  function autoRotateOption() {
     8    if (jQuery("#rotate_hd").is(':checked')) {
     9      jQuery("<option/>")
     10        .attr("id", "autoRotateOption")
     11        .attr("value", "auto")
     12        .attr("selected", "selected")
     13        .text(autoRotateOptionText)
     14        .appendTo('select[name="rotate_angle"]')
     15      ;
     16    }
     17    else {
     18      jQuery("#autoRotateOption").remove();
     19    }
     20  }
     21
     22  autoRotateOption();
     23  jQuery('#rotate_hd').click(function() {
     24    autoRotateOption();
     25  });
     26
    527  jQuery('#applyAction').click(function(e) {
    628    if (elements.length != 0)
     
    6789    return false;
    6890  });
    69 
     91});
    7092{/literal}{/footer_script}
    7193
    7294<div id="rotate_image" class="bulkAction">
    73   <table style="margin-left:20px;">
    74     <tr>
    75       <th id="thumb_width_th">{'Angle'|@translate}</th>
    76       <td>
    77       <select name="rotate_angle">
    78         {foreach from=$angles item=angle}
    79           <option value="{$angle.value}" {if $saved_angle eq $angle.value}selected="selected"{/if}>{$angle.name}</option>
    80         {/foreach}
    81       </select>
    82       </td>
    83     </tr>
    84     {if $library != 'gd'}
    85     <tr>
    86       <th><label for="rotate_hd">{'Also rotate HD image'|@translate}</label></th>
    87       <td><input type="checkbox" name="rotate_hd" id="rotate_hd" checked="checked"></td>
    88     </tr>
    89     {/if}
    90   </table>
     95{if $library != 'gd'}
     96  <p><label>
     97    <input type="checkbox" name="rotate_hd" id="rotate_hd" checked="checked">
     98    <strong>{'Also rotate HD image'|@translate}</strong>
     99  </label></p>
     100{/if}
     101  <p><label>
     102    <strong>{'Angle'|@translate}</strong>
     103    <br>
     104    <select name="rotate_angle">
     105{foreach from=$angles item=angle}
     106      <option value="{$angle.value}" {if $saved_angle eq $angle.value}selected="selected"{/if}>{$angle.name}</option>
     107{/foreach}
     108    </select>
     109  </label></p>
    91110</div>
  • extensions/rotateImage/ws_functions.inc.php

    r13316 r13319  
    3737  include_once(PHPWG_ROOT_PATH.'admin/include/image.class.php');
    3838  $image_id=(int)$params['image_id'];
    39   $angle=(int)$params['angle'];
    40   $rotate_hd = get_boolean($params['rotate_hd']);
     39 
    4140  $query='
    4241SELECT id, path, tn_ext, has_high
     
    5049  }
    5150
    52   if ($rotate_hd and get_boolean($image['has_high'])) {
     51  // rotation angle
     52  if ('auto' == $params['angle']) {
     53    $angle = $params['angle'];
     54  }
     55  else {
     56    $angle = (int)$params['angle'];
     57  }
     58
     59  if (get_boolean($params['rotate_hd']) and get_boolean($image['has_high'])) {
    5360    $to_rotate_path = file_path_for_type($image['path'], 'high');
    5461    $quality = $conf['upload_form_hd_quality'];
    5562    $regenerate_websize = true;
     63
     64    if ('auto' == $angle) {
     65      $angle = pwg_image::get_rotation_angle($to_rotate_path);
     66    }
    5667  }
    5768  else {
Note: See TracChangeset for help on using the changeset viewer.