Changeset 26308


Ignore:
Timestamp:
12/29/13 11:02:14 (6 years ago)
Author:
mistic100
Message:

hide NESW handles when forcing ratio

Location:
extensions/header_manager
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • extensions/header_manager/admin/add.php

    r26298 r26308  
    1313{ 
    1414  include_once(HEADER_MANAGER_PATH . 'include/banner.class.php'); 
     15   
     16  $conf['header_manager']['keep_ratio'] = isset($_POST['keep_ratio']); 
     17  conf_update_param('header_manager', serialize($conf['header_manager'])); 
    1518   
    1619  $banner = get_banner($_POST['picture_file']); 
     
    118121    'picture' => $picture, 
    119122    'crop' => hm_get_crop_display($picture), 
     123    'keep_ratio' => $conf['header_manager']['keep_ratio'], 
    120124    )); 
    121125} 
  • extensions/header_manager/admin/template/add.tpl

    r26299 r26308  
    1717    boxHeight: {$crop.box_height}, 
    1818    trueSize: [{$picture.width}, {$picture.height}], 
    19     aspectRatio: {$crop.real_width}/{$crop.real_height}, 
     19    {if $keep_ratio}aspectRatio: {$crop.real_width}/{$crop.real_height},{/if} 
    2020    setSelect: [{$crop.l}, {$crop.t}, {$crop.r}, {$crop.b}], 
    2121    onChange: function(sel) { 
     
    3737  function() { 
    3838    jcrop_api = this; 
     39    {if $keep_ratio}jQuery(".jcrop-holder").addClass('fixed-ratio');{/if} 
    3940  }); 
    4041   
     
    4647      jcrop_api.release(); 
    4748    } 
     49    jQuery(".jcrop-holder").toggleClass('fixed-ratio'); 
    4850  }); 
    4951}()); 
     
    6062    <li><b>{'Width'|translate}:</b> <span id="width"></span>px</li> 
    6163    <li><b>{'Height'|translate}:</b> <span id="height"></span>px</li> 
    62     <li><label><input type="checkbox" name="keep_ratio" checked> {'Respect %s aspect ratio'|translate:($crop.desired_width|cat:'/'|cat:$crop.desired_height)}</label></li> 
     64    <li><label><input type="checkbox" name="keep_ratio" {if $keep_ratio}checked{/if}> {'Respect %s aspect ratio'|translate:($crop.desired_width|cat:'/'|cat:$crop.desired_height)}</label></li> 
    6365  </ul> 
    6466   
  • extensions/header_manager/admin/template/style.css

    r24010 r26308  
    6262    vertical-align:middle; 
    6363  } 
     64   
     65.jcrop-holder.fixed-ratio .ord-s, 
     66.jcrop-holder.fixed-ratio .ord-n, 
     67.jcrop-holder.fixed-ratio .ord-e, 
     68.jcrop-holder.fixed-ratio .ord-w { 
     69  display:none; 
     70} 
  • extensions/header_manager/include/banner.class.php

    r26298 r26308  
    5151    return $this->get_resize_result($destination_filepath, $crop['width'], $crop['height'], $starttime); 
    5252  } 
    53    
    54   private function get_resize_result($destination_filepath, $width, $height, $time=null) 
    55   { 
    56     return array( 
    57       'source'      => $this->source_filepath, 
    58       'destination' => $destination_filepath, 
    59       'width'       => $width, 
    60       'height'      => $height, 
    61       'size'        => floor(filesize($destination_filepath) / 1024).' KB', 
    62       'time'        => $time ? number_format((get_moment() - $time) * 1000, 2, '.', ' ').' ms' : null, 
    63       'library'     => $this->library, 
    64     ); 
    65   } 
    6653} 
  • extensions/header_manager/maintain.inc.php

    r26298 r26308  
    1212      'display' => 'image_only', 
    1313      'banner_on_picture' => true, 
     14      'keep_ratio' => true 
    1415    ); 
    1516 
     
    2728    { 
    2829      $new_conf = is_string($conf['header_manager']) ? unserialize($conf['header_manager']) : $conf['header_manager']; 
     30       
    2931      if (!isset($new_conf['banner_on_picture'])) 
    3032      { 
    3133        $new_conf['banner_on_picture'] = true; 
    32         $conf['header_manager'] = serialize($new_conf); 
    33         conf_update_param('header_manager', $conf['header_manager']); 
    3434      } 
     35      else if (!isset($new_conf['keep_ratio'])) 
     36      { 
     37        $new_conf['keep_ratio'] = true; 
     38      } 
     39       
     40      $conf['header_manager'] = serialize($new_conf); 
     41      conf_update_param('header_manager', $conf['header_manager']); 
    3542    } 
    3643 
Note: See TracChangeset for help on using the changeset viewer.