PDA

View Full Version : Exposure error in reduceExif of functions.php


londonrubbish
09-29-2005, 09:45 AM
The function reduceExif in functions.php incorrectly reduces exposure times of 1 second or more,

i.e. for a 10 (ten) second exposure time it is returned as:

1/0

The function could be re-written as below, but others may find a more efficient way.

function &reduceExif($exifvalue)
{

$vals = split("/",$exifvalue);
if(count($vals) == 2) {
// MJS 29092005 - Code to deal with exposure times of > 1 sec
if ( $vals[1] == 0 ) {
$exposure = round($vals[0].$vals[1],2);
} else {
$exposure = round($vals[0]/$vals[1],2);
if ( $exposure < 1 ) $exposure = '1/'.round($vals[1]/$vals[0],0);
}
} else {
$exposure = round($vals[0]/$vals[1], 2);
}
return $exposure;

}

raminia
09-29-2005, 04:22 PM
it's working for me. what was wrong?

Joe[y]
09-29-2005, 04:32 PM
i do find it annoying that 1 second is displayed as 1/1 i suppose.

raminia
09-29-2005, 05:10 PM
which version? the new or the old?

Joe[y]
09-29-2005, 05:18 PM
1.4.2


londonrubbish - do you have a link please?

raminia
09-29-2005, 05:53 PM
http://www.londonrubbish.com/

Joe[y]
09-29-2005, 06:02 PM
i see

(25 mm) | 10 sec | 0 EV (Multi-

i assume you edited functions.php so the problem isn't there anymore. are you using 1.4.2 ?

raminia
09-30-2005, 04:53 PM
the modification that londonrubbish has provided works but I don't know what was the idea behind the proposed algorithm and I'm not diggin into the code to find out.

Dev note: I already have added this into the CVS version