diff options
author | mistic100 <mistic@piwigo.org> | 2012-11-10 20:10:01 +0000 |
---|---|---|
committer | mistic100 <mistic@piwigo.org> | 2012-11-10 20:10:01 +0000 |
commit | c81093b0e943d3625554c808ecb072ef20615d6f (patch) | |
tree | 46509aced35d12035b039207af808d1f2d2a8459 /admin/batch_manager.php | |
parent | 36d17457109f26fa9928897d4e6926d7176159d9 (diff) |
feature:2718 Add batch manager filters for photo dimensions, redesign with sliders
git-svn-id: http://piwigo.org/svn/trunk@18988 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | admin/batch_manager.php | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/admin/batch_manager.php b/admin/batch_manager.php index 8e7a48e0e..e38d52049 100644 --- a/admin/batch_manager.php +++ b/admin/batch_manager.php @@ -100,15 +100,11 @@ if (isset($_POST['submitFilter'])) $_SESSION['bulk_manager_filter']['dimension'][$type] = $_POST['filter_dimension_'. $type ]; } } - } - - if (isset($_POST['filter_ratio_use'])) - { - foreach (array('min','max') as $type) + foreach (array('min_ratio','max_ratio') as $type) { - if ( preg_match('#^[0-9\.,]+$#', $_POST['filter_ratio_'. $type ]) ) + if ( preg_match('#^[0-9\.]+$#', $_POST['filter_dimension_'. $type ]) ) { - $_SESSION['bulk_manager_filter']['ratio'][$type] = str_replace(',','.',$_POST['filter_ratio_'. $type ]); + $_SESSION['bulk_manager_filter']['dimension'][$type] = $_POST['filter_dimension_'. $type ]; } } } @@ -349,7 +345,7 @@ if (!empty($_SESSION['bulk_manager_filter']['tags'])) ); } -if (isset($_SESSION['bulk_manager_filter']['dimension']) or isset($_SESSION['bulk_manager_filter']['ratio'])) +if (isset($_SESSION['bulk_manager_filter']['dimension'])) { $where_clauses = array(); if (isset($_SESSION['bulk_manager_filter']['dimension']['min_width'])) @@ -368,13 +364,13 @@ if (isset($_SESSION['bulk_manager_filter']['dimension']) or isset($_SESSION['bul { $where_clause[] = 'height <= '.$_SESSION['bulk_manager_filter']['dimension']['max_height']; } - if (isset($_SESSION['bulk_manager_filter']['ratio']['min'])) + if (isset($_SESSION['bulk_manager_filter']['dimension']['min_ratio'])) { - $where_clause[] = 'width/height >= '.$_SESSION['bulk_manager_filter']['ratio']['min']; + $where_clause[] = 'width/height >= '.$_SESSION['bulk_manager_filter']['dimension']['min_ratio']; } - if (isset($_SESSION['bulk_manager_filter']['ratio']['max'])) + if (isset($_SESSION['bulk_manager_filter']['dimension']['max_ratio'])) { - $where_clause[] = 'width/height <= '.$_SESSION['bulk_manager_filter']['ratio']['max']; + $where_clause[] = 'width/height <= '.$_SESSION['bulk_manager_filter']['dimension']['max_ratio']; } $query = ' @@ -443,6 +439,30 @@ SELECT id, name $template->assign('tags', get_taglist($query, false)); // +-----------------------------------------------------------------------+ +// | dimensions | +// +-----------------------------------------------------------------------+ +$query = ' +SELECT + MIN(width) as min_width, + MAX(width) as max_width, + MIN(height) as min_height, + MAX(height) as max_height, + MIN(width/height) as min_ratio, + MAX(width/height) as max_ratio + FROM '.IMAGES_TABLE.' +;'; +$dimensions['bounds'] = pwg_db_fetch_assoc(pwg_query($query)); +$dimensions['bounds']['min_ratio'] = floor($dimensions['bounds']['min_ratio']*100)/100; +$dimensions['bounds']['max_ratio'] = ceil($dimensions['bounds']['max_ratio']*100)/100; + +foreach (array_keys($dimensions['bounds']) as $type) +{ + $dimensions['selected'][$type] = isset($_SESSION['bulk_manager_filter']['dimension'][$type]) ? $_SESSION['bulk_manager_filter']['dimension'][$type] : $dimensions['bounds'][$type]; +} +$template->assign('dimensions', $dimensions); + + +// +-----------------------------------------------------------------------+ // | open specific mode | // +-----------------------------------------------------------------------+ |