summaryrefslogtreecommitdiff
path: root/modules/exif
diff options
context:
space:
mode:
Diffstat (limited to 'modules/exif')
-rw-r--r--modules/exif/lib/exif.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/modules/exif/lib/exif.php b/modules/exif/lib/exif.php
index 21b028f8..bd72f237 100644
--- a/modules/exif/lib/exif.php
+++ b/modules/exif/lib/exif.php
@@ -1007,8 +1007,16 @@ if ($result['ValidJpeg'] == 1) {
//================================================================================================
function ConvertToFraction($v, &$n, &$d)
{
- $n = 1;
- $d = !empty($v) ? round(1.0 / $v) : 0;
+ if ($v == 0) {
+ $n = 0;
+ $d = 1;
+ return;
+ }
+ for ($n=1; $n<100; $n++) {
+ $v1 = 1/$v*$n;
+ $d = round($v1, 0);
+ if (abs($d - $v1) < 0.02) return;// within tolarance
+ }
}
//================================================================================================