diff options
author | mistic100 <mistic@piwigo.org> | 2012-11-21 14:28:55 +0000 |
---|---|---|
committer | mistic100 <mistic@piwigo.org> | 2012-11-21 14:28:55 +0000 |
commit | ad4c9f96a59953eb946a02519efe8aadc6ab28f2 (patch) | |
tree | fcc609f38809a2f8f40f22b974b2195bc24de2dc /admin/batch_manager.php | |
parent | f35e8ccc3dd374dc551d0d859716dd3b007ca466 (diff) |
feature:2718 Add batch manager filters for photo dimensions, small cleaning in the code
git-svn-id: http://piwigo.org/svn/trunk@19121 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | admin/batch_manager.php | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/admin/batch_manager.php b/admin/batch_manager.php index b431f6e8c..65a47ad0e 100644 --- a/admin/batch_manager.php +++ b/admin/batch_manager.php @@ -370,7 +370,8 @@ if (isset($_SESSION['bulk_manager_filter']['dimension'])) } if (isset($_SESSION['bulk_manager_filter']['dimension']['max_ratio'])) { - $where_clause[] = 'width/height <= '.sprintf('%.2f99', $_SESSION['bulk_manager_filter']['dimension']['max_ratio']); + // max_ratio is a floor value, so must be a bit increased + $where_clause[] = 'width/height < '.($_SESSION['bulk_manager_filter']['dimension']['max_ratio']+0.01); } $query = ' @@ -446,6 +447,7 @@ $widths = array(); $heights = array(); $ratios = array(); +// get all width, height and ratios $query = ' SELECT DISTINCT width, height @@ -454,6 +456,7 @@ SELECT AND height IS NOT NULL ;'; $result = pwg_query($query); + while ($row = pwg_db_fetch_assoc($result)) { $widths[] = $row['width']; @@ -474,8 +477,6 @@ $dimensions['widths'] = implode(',', $widths); $dimensions['heights'] = implode(',', $heights); $dimensions['ratios'] = implode(',', $ratios); -$dimensions['bounds'] = pwg_db_fetch_assoc(pwg_query($query)); - $dimensions['bounds'] = array( 'min_width' => $widths[0], 'max_width' => $widths[count($widths)-1], @@ -485,6 +486,7 @@ $dimensions['bounds'] = array( 'max_ratio' => $ratios[count($ratios)-1], ); +// find ratio categories $ratio_categories = array( 'portrait' => array(), 'square' => array(), @@ -498,18 +500,15 @@ foreach ($ratios as $ratio) { $ratio_categories['portrait'][] = $ratio; } - - if ($ratio >= 0.95 and $ratio < 1.05) + else if ($ratio >= 0.95 and $ratio <= 1.05) { $ratio_categories['square'][] = $ratio; } - - if ($ratio > 1.05 and $ratio <= 2.5) + else if ($ratio > 1.05 and $ratio < 2) { $ratio_categories['landscape'][] = $ratio; } - - if ($ratio > 2.5) + else if ($ratio >= 2) { $ratio_categories['panorama'][] = $ratio; } @@ -526,6 +525,7 @@ foreach (array_keys($ratio_categories) as $ratio_category) } } +// selected=bound if nothing selected foreach (array_keys($dimensions['bounds']) as $type) { $dimensions['selected'][$type] = isset($_SESSION['bulk_manager_filter']['dimension'][$type]) |