Piwigo.org

You are not logged in. (Register / Login)

Announcement

#1 2016-03-20 12:55:27

Joe_76
Guest

[Plugin Exif View] Wrong calculation of long exposure time

Hello,

I have found a little error in the plugin "Exif View".
Line 121 is:

Code:

elseif ($tokens[1] > 0)

must be:

Code:

elseif ($tokens[1] > 1)

Otherwise the calculation of exposure time over 1s isn't correct.

Kind regards
Joe

 

#2 2016-11-19 22:42:52

todd
Member
Registered: 2014-11-27
Posts: 17

Re: [Plugin Exif View] Wrong calculation of long exposure time

Joe_76 wrote:

Hello,

I have found a little error in the plugin "Exif View".
Line 121 is:

Code:

elseif ($tokens[1] > 0)

must be:

Code:

elseif ($tokens[1] > 1)

Otherwise the calculation of exposure time over 1s isn't correct.

Kind regards
Joe

Thanks this worked for me for my exposures that are longer than 1s, but not for my exposures that are longer than a minute... I'm not smart enough to figure out what will make it work... I changed line 121 to:

elseif ($tokens[1] > 10) and it didn't display my 2 and 3 minute exposures correctly, and if I change it to:

elseif ($tokens[1] > 100) then it displays a 120s exposure (for example) as 12000 s

Last edited by todd (2016-11-19 22:43:48)

Offline

 

#3 2016-11-20 00:45:42

todd
Member
Registered: 2014-11-27
Posts: 17

Re: [Plugin Exif View] Wrong calculation of long exposure time

Also, it still doesn't report right if the exposure time has a decimal...  For example 4.86s reports as 1/0 s (as do any exosures longer than a minute after making the above fix for longer than 1s....)

Offline

 

#4 2016-11-27 06:44:42

todd
Member
Registered: 2014-11-27
Posts: 17

Re: [Plugin Exif View] Wrong calculation of long exposure time

todd wrote:

Joe_76 wrote:

Hello,

I have found a little error in the plugin "Exif View".
Line 121 is:

Code:

elseif ($tokens[1] > 0)

must be:

Code:

elseif ($tokens[1] > 1)

Otherwise the calculation of exposure time over 1s isn't correct.

Kind regards
Joe

Thanks this worked for me for my exposures that are longer than 1s, but not for my exposures that are longer than a minute... I'm not smart enough to figure out what will make it work... I changed line 121 to:

elseif ($tokens[1] > 10) and it didn't display my 2 and 3 minute exposures correctly, and if I change it to:

elseif ($tokens[1] > 100) then it displays a 120s exposure (for example) as 12000 s

Well it seems I made one step in the right direction so far, just by messing around (aka quesswork).

for line 123 I changed:        while ($tokens[0] % 10 == 0)
to:                                       while ($tokens[0] % 100 == 0)

This makes it so my long exposures are reported correctly as long as they are whole seconds... For example a 180s exposure reports now as 180s.

It's still reporting "1/0 s" if there is a decimal (due to a lazy long bulb exposure, say 180.33s for example) so not sure if I'm going to get lucky on this, but will report back if I do.. ;)

Last edited by todd (2016-11-27 06:51:00)

Offline

 

#5 2016-12-26 21:39:23

cars10
Guest

Re: [Plugin Exif View] Wrong calculation of long exposure time

Hello!

I rejected the whole elseif-structure and tried this calculation (starts at line 111):

   // exposure time
     if (!(strpos($key, 'ExposureTime') === FALSE)) {
      $tokens = explode('/', $value);

      if (isset($tokens[1]) && ($tokens[1] < $tokens[0]) )
      {
        return  $tokens[0]/$tokens[1].' s';           
      }
      else
      {
        return $value.' s';
      }
   }

It looks fine with the values produced by my Canon camera.

Kind regards
cars10

 

#6 2017-01-02 06:46:16

todd
Member
Registered: 2014-11-27
Posts: 17

Re: [Plugin Exif View] Wrong calculation of long exposure time

cars10 wrote:

Hello!

I rejected the whole elseif-structure and tried this calculation (starts at line 111):

   // exposure time
     if (!(strpos($key, 'ExposureTime') === FALSE)) {
      $tokens = explode('/', $value);

      if (isset($tokens[1]) && ($tokens[1] < $tokens[0]) )
      {
        return  $tokens[0]/$tokens[1].' s';           
      }
      else
      {
        return $value.' s';
      }
   }

It looks fine with the values produced by my Canon camera.

Kind regards
cars10

Thank you very much! This works better for me too.. Even reports odd untimed bulb time results with the decimals.

I did happen to notice with your code that some fractions don't report reduced. 1/2s will report as 5/10s etc... No biggy though! :)

Offline

 

Board footer

Powered by FluxBB

github twitter facebook google+ newsletter Donate Piwigo.org © 2002-2017 · Contact