4images Forum & Community

4images Issues / Ausgaben => Discussion & Troubleshooting => Topic started by: om6acw on October 04, 2008, 06:25:06 AM

Title: Problem with EXIF
Post by: om6acw on October 04, 2008, 06:25:06 AM
Hi there,
I have one small problem with exif on my website.
I'm starting taking pictures with longer exposure time like 1 second and right now my exif script doesn't know how to show this information correctly. So can somebody help my with that?
Here is how actually my script looks like

Code: [Select]
case "ExposureTime":
      $valpieces = explode("/",$val);
      $val = round(($valpieces[1] / $valpieces[0]), 0);
      $val = "1/" . $val . " seconds";
      break;

With this code all photos taken with longer exposure time like 1s is showed like 1/0s
I try to use old code for this value

Code: [Select]
case "ExposureTime":
       $val = $val . " seconds";
       break;

but then my exposure time was show in not right and easy understandable format like this 100/1192
in this case right time was 119.2 second

so its something what I can do with that?
Thanks to everybody for help.
Title: Re: Problem with EXIF
Post by: V@no on October 04, 2008, 06:52:00 AM
This should do it:
case "ExposureTime":
        $valpieces = explode("/",$val);
        if ($valpieces[0] > 0 && $valpieces[1] > 0)
          $e = $valpieces[0] / $valpieces[1];
        else
          $e = $val;
        if ($e < 1 && $e > 0)
          $val = "1/" . round(1 / $e, 0);
        else
          $val = round($e, 1);
        $val .= " seconds";
      break;


(not tested)
Title: Re: Problem with EXIF
Post by: om6acw on October 04, 2008, 04:04:25 PM
HI V@no thanks for help.

with your code long time exposures are shown like 1/119 second (original 119.2 second) and short time exposures (under 1 sec) 350 second and should be 1/350 sec.
Title: Re: Problem with EXIF
Post by: V@no on October 04, 2008, 05:57:23 PM
Ops. wrong one line...should work now.
Title: Re: Problem with EXIF
Post by: Rembrandt on October 04, 2008, 07:38:00 PM
Hi!
.....
Quote
case "ExposureTime":
$exposure_time=explode("/",$val);
if ($exposure_time[0]>0)  {
$exposure_time[1] = round($exposure_time[1]/$exposure_time[0]);
$exposure_time[0] = $exposure_time[0]/$exposure_time[0];}
$val = $exposure_time[0]."/".$exposure_time[1]." seconds";
break;

mfg Andi

Title: Re: Problem with EXIF
Post by: om6acw on October 05, 2008, 12:28:25 AM
Ops. wrong one line...should work now.

Right now is working great, thanks a lot V@no.