plegall / Piwigo-exif_view

4 stars 6 forks source link

Shutter speed is truncated instead of rounded #19

Open dguertin opened 9 months ago

dguertin commented 9 months ago

I recently made a discovery on my Canon R6: the shutter speed EXIF data that is saved is not exactly the same as the shutter speed that is set. For example, a recent photo I took at a shutter speed of 1/640 is saved by the camera as 104858/67109119 (!), which is equal to 1/639.999990463. That's pretty close to 1/640, and most EXIF utilities I've used on the photo report 1/640. But in my Piwigo gallery, it's reported as 1/639 by the Exif View plugin. That looks odd, and it would be nice if it would show 1/640 instead.

Thanks to a tip on the Piwigo GitHub site, I've been able to correct this by modifying line 129 of the exif_view/main.inc.php file:

 //         return '1/'.floor(1/($tokens[0]/$tokens[1])).' s';
            return '1/'.round(1/($tokens[0]/$tokens[1])).' s';

Could this be made the default behavior?