diff options
Diffstat (limited to '')
-rw-r--r-- | admin/batch_manager.php | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/admin/batch_manager.php b/admin/batch_manager.php index 71f3c72f6..7feb5a6a2 100644 --- a/admin/batch_manager.php +++ b/admin/batch_manager.php @@ -90,6 +90,19 @@ if (isset($_POST['submitFilter'])) } } } + + if (isset($_POST['filter_dimension_use'])) + { + if ( $_POST['filter_dimension'] != 'format' and !preg_match('#^[0-9]+$#', $_POST['filter_dimension_'. $_POST['filter_dimension'] ]) ) + { + array_push($page['errors'], l10n('Invalid dimension')); + } + else + { + $_SESSION['bulk_manager_filter']['dimension'] = $_POST['filter_dimension']; + $_SESSION['bulk_manager_filter']['dimension_'. $_POST['filter_dimension'] ] = $_POST['filter_dimension_'. $_POST['filter_dimension'] ]; + } + } } if (isset($_GET['cat'])) @@ -327,6 +340,44 @@ if (!empty($_SESSION['bulk_manager_filter']['tags'])) ); } +if (isset($_SESSION['bulk_manager_filter']['dimension'])) +{ + switch ($_SESSION['bulk_manager_filter']['dimension']) + { + case 'min_width': + $where_clause = 'width >= '.$_SESSION['bulk_manager_filter']['dimension_min_width']; break; + case 'max_width': + $where_clause = 'width <= '.$_SESSION['bulk_manager_filter']['dimension_max_width']; break; + case 'min_height': + $where_clause = 'height >= '.$_SESSION['bulk_manager_filter']['dimension_min_height']; break; + case 'max_height': + $where_clause = 'height <= '.$_SESSION['bulk_manager_filter']['dimension_max_height']; break; + case 'format': + { + switch ($_SESSION['bulk_manager_filter']['dimension_format']) + { + case 'portrait': + $where_clause = 'width/height < 0.95'; break; + case 'square': + $where_clause = 'width/height >= 0.95 AND width/height <= 1.05'; break; + case 'landscape': + $where_clause = 'width/height > 1.05 AND width/height < 2.5'; break; + case 'panorama': + $where_clause = 'width/height >= 2.5'; break; + } + break; + } + } + + $query = ' +SELECT id + FROM '.IMAGES_TABLE.' + WHERE '.$where_clause.' + '.$conf['order_by']; + + $filter_sets[] = array_from_query($query, 'id'); +} + $current_set = array_shift($filter_sets); foreach ($filter_sets as $set) { |