ZenphotoCMS Forum
division by zero error in exif.php in 1.1.6 - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: division by zero error in exif.php in 1.1.6 (/thread-3002.html)



division by zero error in exif.php in 1.1.6 - firsttimeuser - 2008-05-30

i guess this may be due to some faulty exif data in the image (exposure time?),

the line err'ing was 370, so on line 370, in version 1.1.6, so i just muted the error:

from
if (($bottom % $top) == 0) {

to
if (@($bottom % $top) == 0) {

is this sensible?




division by zero error in exif.php in 1.1.6 - firsttimeuser - 2008-05-30

line 371 was err'ing as well, so i added a check for zero to the code:

    } else if ($tag == '829a') { // Exposure Time
        if ($top == 0){
            $data = 'Unknown';
        }
        else if (($bottom % $top) == 0) {...

anyway, there's a lot of if / elseif's there for the tags, wouldn't a switch be neater?