PDA

View Full Version : Exif problem with aperture


mightydrake
07-29-2008, 07:58 PM
I get problems with the exif data, especially the aperture value and focal length. Values appear with lots of decimals.

Example : f 7.1 will show as f 7.0999999046326
f 2.8 will show as f 2.7999999523163

that's with pictures from a Nikon D80.

Is there something I can do to fix this ? I looked into exif.php, and found the lines that seems to calculate the aperture:
$data = exp(($data*log(2))/2);
$data = round($data, 1);//Focal is given with a precision of 1 digit.
$data="f ".$data;

jaywilliams
07-29-2008, 08:05 PM
If possible, could you post a link to a photo that has EXIF info that causes this?

That way we can try the photo on our own systems and figure out a solution that way.

mightydrake
07-29-2008, 08:11 PM
yep sure, http://www.kevinturcotte.net, the first picture got the aperture problems.

thanks for the quick reply.

Dennis
07-30-2008, 06:10 AM
what version of Pixelpost do you use?

mightydrake
07-30-2008, 01:47 PM
Im using 1.7.1

It's strange that in some picture, the exif data shows correctly.

jaywilliams
07-30-2008, 02:05 PM
The second one on your site, the sail boat one, does cause the Aperture to display a long string. I'll report back with with my findings.

jaywilliams
07-30-2008, 02:18 PM
Ok, here is a fix.

Open up the file /includes/functions_exif.php

Find the line that says:
$aperture = $exif_result['FNumberSubIFD']; // Aperture
On my copy that should be around line # 86.

Once you've found that, add this text directly below that, so it looks like this:

$aperture = $exif_result['FNumberSubIFD']; // Aperture

// [BEGIN] Round Aperture Hack
$aperture = round(trim($aperture,' f'),1);
$aperture = "f $aperture";
// [END] Round Aperture Hack


Here is a screenshot of how it should look when you're done:
http://idisk.d3done.com/aperture-hack-20080730-091728.png

Now simply save the file, upload it to your server, and enjoy!

mightydrake
07-30-2008, 03:02 PM
nice, that fixed the problem. Thanks a lot for all your help.