Changeset 27556


Ignore:
Timestamp:
03/04/14 13:42:06 (5 years ago)
Author:
plg
Message:

avoid division by zero on digital zoom

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/exif_view/main.inc.php

    r27136 r27556  
    11<?php /* 
    22Plugin Name: Exif View 
    3 Version: auto 
     3Version: 2.6.b 
    44Description: Converts EXIF values to human readable localized values. Corresponds to EXIF specification 2.2, details in http://www.exif.org. Easily extensible. 
    55Plugin URI: http://piwigo.org/ext/extension_view.php?eid=155 
     
    215215   if (!(strpos($key, 'DigitalZoomRatio') === FALSE)) { 
    216216      $tokens = explode('/', $value); 
    217       return ($tokens[0]/$tokens[1]); 
     217      if (isset($tokens[1])) 
     218      { 
     219        if ($tokens[1] > 0) 
     220        { 
     221          return ($tokens[0]/$tokens[1]); 
     222        } 
     223        else 
     224        { 
     225          return $tokens[0]; 
     226        } 
     227      } 
     228      else 
     229      { 
     230        return $value; 
     231      } 
    218232   } 
    219233 
Note: See TracChangeset for help on using the changeset viewer.