Merged revision(s) 24835 from trunk:
bug 2970: Division by zero on batch manager git-svn-id: http://piwigo.org/svn/branches/2.5@24880 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
55a1acf32c
commit
161be2a7c7
1 changed files with 15 additions and 11 deletions
|
@ -457,21 +457,25 @@ SELECT
|
|||
;';
|
||||
$result = pwg_query($query);
|
||||
|
||||
if (!pwg_db_num_rows($result))
|
||||
if (pwg_db_num_rows($result))
|
||||
{
|
||||
while ($row = pwg_db_fetch_assoc($result))
|
||||
{
|
||||
if ($row['width']>0 && $row['height']>0)
|
||||
{
|
||||
$widths[] = $row['width'];
|
||||
$heights[] = $row['height'];
|
||||
$ratios[] = floor($row['width'] / $row['height'] * 100) / 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (empty($widths))
|
||||
{ // arbitrary values, only used when no photos on the gallery
|
||||
$widths = array(600, 1920, 3500);
|
||||
$heights = array(480, 1080, 2300);
|
||||
$ratios = array(1.25, 1.52, 1.78);
|
||||
}
|
||||
else
|
||||
{
|
||||
while ($row = pwg_db_fetch_assoc($result))
|
||||
{
|
||||
$widths[] = $row['width'];
|
||||
$heights[] = $row['height'];
|
||||
$ratios[] = floor($row['width'] * 100 / $row['height']) / 100;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$widths = array_unique($widths);
|
||||
|
@ -530,7 +534,7 @@ foreach (array_keys($ratio_categories) as $ratio_category)
|
|||
{
|
||||
$dimensions['ratio_'.$ratio_category] = array(
|
||||
'min' => $ratio_categories[$ratio_category][0],
|
||||
'max' => $ratio_categories[$ratio_category][count($ratio_categories[$ratio_category]) - 1]
|
||||
'max' => array_pop($ratio_categories[$ratio_category]),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue