Changeset 24880


Ignore:
Timestamp:
Oct 12, 2013, 10:53:45 PM (7 years ago)
Author:
mistic100
Message:

Merged revision(s) 24835 from trunk:
bug 2970: Division by zero on batch manager

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.5/admin/batch_manager.php

    r19920 r24880  
    458458$result = pwg_query($query);
    459459
    460 if (!pwg_db_num_rows($result))
     460if (pwg_db_num_rows($result))
     461{
     462  while ($row = pwg_db_fetch_assoc($result))
     463  {
     464    if ($row['width']>0 && $row['height']>0)
     465    {
     466      $widths[] = $row['width'];
     467      $heights[] = $row['height'];
     468      $ratios[] = floor($row['width'] / $row['height'] * 100) / 100;
     469    }
     470  }
     471}
     472if (empty($widths))
    461473{ // arbitrary values, only used when no photos on the gallery
    462474  $widths = array(600, 1920, 3500);
     
    464476  $ratios = array(1.25, 1.52, 1.78);
    465477}
    466 else
    467 {
    468   while ($row = pwg_db_fetch_assoc($result))
    469   {
    470     $widths[] = $row['width'];
    471     $heights[] = $row['height'];
    472     $ratios[] = floor($row['width'] * 100 / $row['height']) / 100;
    473   }
    474 }
     478
    475479
    476480
     
    531535    $dimensions['ratio_'.$ratio_category] = array(
    532536      'min' => $ratio_categories[$ratio_category][0],
    533       'max' => $ratio_categories[$ratio_category][count($ratio_categories[$ratio_category]) - 1]
     537      'max' => array_pop($ratio_categories[$ratio_category]),
    534538      );
    535539  }
Note: See TracChangeset for help on using the changeset viewer.