Olympus UK E-System User Group
Olympus UK E-System User Group

Join our unique resource for Olympus Four Thirds E-System DSLR and Pen and OM-D Micro Four Thirds photographers. Show your images via our free e-group photo gallery. Please read the e-group.uk.net forum terms and conditions before posting for the first time. Above all, welcome!


Go Back   Olympus UK E-System User Group > Out of Focus area > The lounge

The lounge Relax, take a break from photo and camera talk - have a chat about something else for a change. Just keep it clean and polite!

Reply
 
Thread Tools Display Modes
  #16  
Old 10th July 2011
Kees's Avatar
Kees Kees is offline
Full member
 
Join Date: Jul 2010
Location: Netherlands
Posts: 202
Thanks: 39
Thanked 18 Times in 15 Posts
Likes: 0
Liked 0 Times in 0 Posts
Re: Any php specialists out there?

Quote:
Originally Posted by PaulE View Post
In short I don't quite know - all the 3rd party exif readers I tested return the correct focal length - which it must somehow be calculating from the value 100/677 that is stored in the focal length tag. I'm no mathematician and I gave up trying to work out a solution that would work with a range of shutter speeds.

The other possibilty (although I think is probably unlikely) is that other programs could be using the value for focal length in terms of 35mm film - which is correctly reported as 28mm from other values within the exif ([ResolutionUnit], [YResolution], [YResolution] etc)the crop factor of the sensor can be determined and so an accurate focal length calculated this way - a long way around the problem - which apparently can be unreliable with some cameras as they don't report the resolution data correctly. Of course if Ian only ever planned to use the script with 4/3rds images then he could bodge it by hardcoding the crop factor at 2 and then an accurate FL could be easily caluculated - not a clever idea really though and one that would come back to bite in the future.

Its definitely possible to get it working it's just a matter of time and effort - probably a very easy task for someone who knows what their doing...
Or maybe other routines don't use the name tags, but fixed offsets to access the right position for the data. Then the fields can have a different name, but the correct data would still be in the same relative position and you'd still get the right answer. I don't know enough of how this was set up to be of any practical use in this regard though.
Reply With Quote
  #17  
Old 10th July 2011
PaulE PaulE is offline
Full member
 
Join Date: May 2008
Location: Mid Wales
Posts: 330
Thanks: 0
Thanked 3 Times in 3 Posts
Likes: 0
Liked 0 Times in 0 Posts
Re: Any php specialists out there?

Quote:
Originally Posted by Kees View Post
Or maybe other routines don't use the name tags, but fixed offsets to access the right position for the data. Then the fields can have a different name, but the correct data would still be in the same relative position and you'd still get the right answer. I don't know enough of how this was set up to be of any practical use in this regard though.
Using tagnames or fixed offset exif_tagname(0x920a) returns the same thing "100/677" it's not a case of not getting the right header or value its a case of it not being what you would expect it to be i.e. 100 / 677 = 0.1477104874446086 - it can't be a co-incidence that that figure could be turned into 14mm by muliplying it by 10 and taking the float value (or by divding the denominator by 100 before resolving the fraction) but I can see no reason why this should be done and further more other returned shutter speeds don't follow the same rule - there's got to be a simple trick to it but I just can't see it...
Reply With Quote
  #18  
Old 11th July 2011
Ian's Avatar
Ian Ian is online now
Administrator
 
Join Date: Jul 2007
Location: Hemel Hempstead, Hertfordshire, UK
Posts: 11,567
Thanks: 423
Thanked 2,522 Times in 1,269 Posts
Likes: 864
Liked 1,695 Times in 769 Posts
Re: Any php specialists out there?

Quote:
Originally Posted by Kees View Post
How can it be that my EXIF Reader gives correct results if this is the case?
Yes, this is why I was scratching my head The PhotoPost galleries that members use relies on JHEAD to extract exif data and doesn't seem to me phased by images from the new cameras.

Incidentally, in an attempt to fix the exif problem we updated to the latest release of PHP on our servers, without any success.

Ian
__________________
Founder and editor of:
Olympus UK E-System User Group (http://e-group.uk.net)
Four Thirds User (http://fourthirds-user.com)
Digital Photography Now (http://dpnow.com)
Olympus camera, lens, and accessory hire (http://e-group.uk.net/hire)

Twitter: www.twitter.com/ian_burley
Flickr: www.flickr.com/photos/dpnow/
Pinterest: www.pinterest.com/ianburley/
NEW: My personal BLOG ianburley.com
Reply With Quote
  #19  
Old 11th July 2011
PaulE PaulE is offline
Full member
 
Join Date: May 2008
Location: Mid Wales
Posts: 330
Thanks: 0
Thanked 3 Times in 3 Posts
Likes: 0
Liked 0 Times in 0 Posts
Re: Any php specialists out there?

Quote:
Originally Posted by Ian View Post
Yes, this is why I was scratching my head The PhotoPost galleries that members use relies on JHEAD to extract exif data and doesn't seem to me phased by images from the new cameras.

Incidentally, in an attempt to fix the exif problem we updated to the latest release of PHP on our servers, without any success.

Ian
I've looked a bit more at it and have reached a dead end - calculating the crop factor and using that to calculate FL from the [FocalLengthIn35mmFilm] value doesn't seem to be possible either as the values for the (focal plane )[XResolution] => 6515054/759385412 and [YResolution] => 3360327/180 - the figures are wildly different even considering the 4/3rds sensor shape - there's something really odd going on here which to me must be due to the sole fact that the phpExif function is built to be compliant with exifversion 2.2 and not 2.3 - I can't see any other reason for it.

If it's not down to this alone then perhaps JHEAD is using a library of know Crop factors and or sensor sizes etc to calculate the FL or is possibly even able to parse the maker notes to get the values that way??? it's confusing whatever the case - it'll be interesting to find the answer - if you get it...
Reply With Quote
  #20  
Old 11th July 2011
PaulE PaulE is offline
Full member
 
Join Date: May 2008
Location: Mid Wales
Posts: 330
Thanks: 0
Thanked 3 Times in 3 Posts
Likes: 0
Liked 0 Times in 0 Posts
Re: Any php specialists out there?

Quote:
Originally Posted by Kees View Post
Or maybe other routines don't use the name tags, but fixed offsets to access the right position for the data. Then the fields can have a different name, but the correct data would still be in the same relative position and you'd still get the right answer. I don't know enough of how this was set up to be of any practical use in this regard though.
***EDIT
I think you are right in that the other scripts are using fixed offsets to get the values directly from the file - php exif_read_data is definitely looking at the right place within the file but why it doesn't return a sensible value I don't know. I done a bit of reading and came across a script that bypasses phps inbuilt exif_read_data function and reads byte by byte and hey presto pulling the value from the same offset that exif_read_data presumably uses for FocalLength (0x920a) returns a correct value of 14mm (after some correcting for byte order, data type etc) - it's very strange and far too complicated for me to get my head around but is at least there is a simple fix. Using the script below (under GNU General Public License) would save alot of hassle and seems to work perfectly:
http://www.jakeo.com/software/exif/index.php

then your script becomes:
Code:
// extract and display the exif data
	include('exif.php');

	$result = read_exif_data_raw($myfile,0);	

	$exposuretime = $result['SubIFD']['ExposureTime']; 
	$aperture = $result['SubIFD']['FNumber']; 
	$ISO = $result['SubIFD']['ISOSpeedRatings'];
	$focallength = $result['SubIFD']['FocalLength'];  

	echo "Shutter Speed: ".$exposuretime."<br/>\n";
	echo "Aperture: ".$aperture."<br/>\n";
	echo "ISO: ".$ISO."<br/>\n";
	echo "Focal Length: ".$focallength."<br/>\n";
It should be a simple 2min fix with no more worrying about strange formats, byte order and datatypes etc.
HTH
Paul.
Reply With Quote
  #21  
Old 12th July 2011
Ian's Avatar
Ian Ian is online now
Administrator
 
Join Date: Jul 2007
Location: Hemel Hempstead, Hertfordshire, UK
Posts: 11,567
Thanks: 423
Thanked 2,522 Times in 1,269 Posts
Likes: 864
Liked 1,695 Times in 769 Posts
Re: Any php specialists out there?

Thanks everyone - I will flag this with David.

Ian
__________________
Founder and editor of:
Olympus UK E-System User Group (http://e-group.uk.net)
Four Thirds User (http://fourthirds-user.com)
Digital Photography Now (http://dpnow.com)
Olympus camera, lens, and accessory hire (http://e-group.uk.net/hire)

Twitter: www.twitter.com/ian_burley
Flickr: www.flickr.com/photos/dpnow/
Pinterest: www.pinterest.com/ianburley/
NEW: My personal BLOG ianburley.com
Reply With Quote
  #22  
Old 12th July 2011
Kees's Avatar
Kees Kees is offline
Full member
 
Join Date: Jul 2010
Location: Netherlands
Posts: 202
Thanks: 39
Thanked 18 Times in 15 Posts
Likes: 0
Liked 0 Times in 0 Posts
Re: Any php specialists out there?

Quote:
Originally Posted by PaulE View Post
***EDIT
I think you are right in that the other scripts are using fixed offsets to get the values directly from the file - php exif_read_data is definitely looking at the right place within the file but why it doesn't return a sensible value I don't know. I done a bit of reading and came across a script that bypasses phps inbuilt exif_read_data function and reads byte by byte and hey presto pulling the value from the same offset that exif_read_data presumably uses for FocalLength (0x920a) returns a correct value of 14mm (after some correcting for byte order, data type etc) - it's very strange and far too complicated for me to get my head around but is at least there is a simple fix. Using the script below (under GNU General Public License) would save alot of hassle and seems to work perfectly:
http://www.jakeo.com/software/exif/index.php

then your script becomes:
Code:
// extract and display the exif data
	include('exif.php');

	$result = read_exif_data_raw($myfile,0);	

	$exposuretime = $result['SubIFD']['ExposureTime']; 
	$aperture = $result['SubIFD']['FNumber']; 
	$ISO = $result['SubIFD']['ISOSpeedRatings'];
	$focallength = $result['SubIFD']['FocalLength'];  

	echo "Shutter Speed: ".$exposuretime."<br/>\n";
	echo "Aperture: ".$aperture."<br/>\n";
	echo "ISO: ".$ISO."<br/>\n";
	echo "Focal Length: ".$focallength."<br/>\n";
It should be a simple 2min fix with no more worrying about strange formats, byte order and datatypes etc.
HTH
Paul.
I agree that this is the sensible solution.
There was an updat of the EXIF format in 2010, so it is also necessary to check if the software is up to date.
If anyone (David?) wants to go to the bottom of it, this is a very useful link.
Reply With Quote
  #23  
Old 14th July 2011
David
Guest
 
Posts: n/a
Re: Any php specialists out there?

Thanks everyone for your help on this issue. I have implemented the solution suggested by PaulE and it works just fine.

David
Reply With Quote
  #24  
Old 14th July 2011
Ian's Avatar
Ian Ian is online now
Administrator
 
Join Date: Jul 2007
Location: Hemel Hempstead, Hertfordshire, UK
Posts: 11,567
Thanks: 423
Thanked 2,522 Times in 1,269 Posts
Likes: 864
Liked 1,695 Times in 769 Posts
Re: Any php specialists out there?

Quote:
Originally Posted by David View Post
Thanks everyone for your help on this issue. I have implemented the solution suggested by PaulE and it works just fine.

David
I would like to add my thanks as well!

And just in time as David and his family are off to Kenya for a special holiday - tomorrow! I'm looking forward to the photos, David!

Ian
__________________
Founder and editor of:
Olympus UK E-System User Group (http://e-group.uk.net)
Four Thirds User (http://fourthirds-user.com)
Digital Photography Now (http://dpnow.com)
Olympus camera, lens, and accessory hire (http://e-group.uk.net/hire)

Twitter: www.twitter.com/ian_burley
Flickr: www.flickr.com/photos/dpnow/
Pinterest: www.pinterest.com/ianburley/
NEW: My personal BLOG ianburley.com
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:24 AM.


The Write Technology Ltd, 2007-2019, All rights reservedAd Management plugin by RedTyger