From 9d12f2ce54239fa2840542682afa685875a4d7ef Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sun, 21 Dec 2014 22:50:56 +0100 Subject: [PATCH] Better focal length calculation #278 --- php/modules/Photo.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/php/modules/Photo.php b/php/modules/Photo.php index ec1f138..3a54bdf 100755 --- a/php/modules/Photo.php +++ b/php/modules/Photo.php @@ -659,7 +659,15 @@ class Photo extends Module { if (isset($temp)) $return['shutter'] = $exif['ExposureTime'] . ' s'; $temp = @$exif['FocalLength']; - if (isset($temp)) $return['focal'] = $temp . ' mm'; + if (isset($temp)) { + if (strpos($temp, '/')!==FALSE) { + $temp = explode('/', $temp, 2); + $temp = $temp[0] / $temp[1]; + $temp = round($temp, 1); + $return['focal'] = $temp . ' mm'; + } + $return['focal'] = $temp . ' mm'; + } $temp = @$exif['DateTimeOriginal']; if (isset($temp)) $return['takestamp'] = strtotime($temp);