diff options
author | mistic100 <mistic@piwigo.org> | 2012-09-15 15:47:52 +0000 |
---|---|---|
committer | mistic100 <mistic@piwigo.org> | 2012-09-15 15:47:52 +0000 |
commit | 0b7bd87646bd4e44474c7b2612a970b6afbbd235 (patch) | |
tree | f2875a980dc18a438101f1c8610da92a837ae897 /admin/batch_manager.php | |
parent | ff130a06af20d09e9ac19767714549f61974e0f8 (diff) |
feature 2718: Add batch manager filters for photo dimensions
git-svn-id: http://piwigo.org/svn/trunk@17931 68402e56-0260-453c-a942-63ccdbb3a9ee
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) { |