| Register - Today's Posts - Search - Tags |
|
#1
|
|||
|
|||
|
EXIFER bug (iso 6553700, 13107400, ...)
At first when I saw these ISO's I thought it's a problem with my image editing program, but when I realize that the same image is read with the correct ISO in my desktop programs (not only the one I edit the image with), I started digging into why the exifer is reading some ISO information incorrectly.
Long story short I learned a little about php and exif reading (I'm a programmer but didn't really know much about both), and I believe I've found a fix for this issue. EXIFER sometimes reads the exif information as a 4 byte data, and sometimes as a 2 byte data, and when it's reading it as a 4 byte data it has the iso information twice in it. I can't really explain why since I didn't really dig into that part when fixing it, but focused on 'fixing' the 4 byte data instead. So for example, as a 2 byte data, ISO '100' is : 0x00000064 (hex). In images where iexifer's reading it as a 4 byte data, it has this data: 0x00640064 And of course, 0x00640064 in hex translates to... 65553700 in decimal. (ISO 200 -> 0x00C800C8 -> 13107400, etc) My solution is to do this in line 397 of exif.php, last line in this snippet (in formatData method): Code:
} else if($type=="USHORT" || $type=="SSHORT" || $type=="ULONG" || $type=="SLONG" || $type=="FLOAT" || $type=="DOUBLE") {
$data = bin2hex($data);
if($intel==1) $data = intel2Moto($data);
if($intel==0 && ($type=="USHORT" || $type=="SSHORT")) $data = substr($data,0,4);
$data=hexdec($data);
if ($tag="8827") $data=65535&$data; //mask 2 bytes for ISO rating
I've tested this with both images that were read correctly and incorrectly previously and looks like it worked. Anyway, I thought I'd share this and my explanation (because I may not be 100% correct, since like I said, before I started I didn't really know much about php and reading EXIF). Last edited by Dennis; 04-10-2007 at 07:42 PM. |
|
#2
|
|||
|
|||
|
that is a good point.... thanks!
I will add this as info to our todo-list! thanks again! |
|
#4
|
|||
|
|||
|
Haha yes absolutely
, good catch. I made another typo there also.. tag should be 8827, not 8227...So make that Code:
if ($tag == "8827") $data=65535&$data; //mask 2 bytes for ISO rating Last edited by GeoS; 10-10-2006 at 04:32 PM. Reason: Added code tag around code :P |
|
#5
|
||||
|
||||
|
Thanks for this solution! Was able to resolve one issue I've been having this evening with exif data.
|
| Post Reply |
| Thread Tools | |
|
|