Delete pagination
This commit is contained in:
2017-02-02 06:46:43 +01:00
parent fa176aba46
commit 3b26d798a9
19 changed files with 3121 additions and 350 deletions

1169
-child/exifer/exif.php Executable file

File diff suppressed because it is too large Load Diff

426
-child/exifer/makers/canon.php Executable file
View File

@@ -0,0 +1,426 @@
<?php //================================================================================================
//================================================================================================
//================================================================================================
/*
Exifer
Extracts EXIF information from digital photos.
Copyright © 2003 Jake Olefsky
http://www.offsky.com/software/exif/index.php
jake@olefsky.com
Please see exif.php for the complete information about this software.
------------
This program is free software; you can redistribute it and/or modify it under the terms of
the GNU General Public License as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. http://www.gnu.org/copyleft/gpl.html
*/
//================================================================================================
//================================================================================================
//================================================================================================
//=================
// Looks up the name of the tag for the MakerNote (Depends on Manufacturer)
//====================================================================
function lookup_Canon_tag($tag) {
switch($tag) {
case "0001": $tag = "Settings 1";break;
case "0004": $tag = "Settings 4";break;
case "0006": $tag = "ImageType";break;
case "0007": $tag = "FirmwareVersion";break;
case "0008": $tag = "ImageNumber";break;
case "0009": $tag = "OwnerName";break;
case "000c": $tag = "CameraSerialNumber";break;
case "000f": $tag = "CustomFunctions";break;
case "0095": $tag = "LensInfo";break;
default: $tag = "unknown:".$tag;break;
}
return $tag;
}
//=================
// Formats Data for the data type
//====================================================================
function formatCanonData($type,$tag,$intel,$data,$exif,&$result) {
$place = 0;
if($type=="ASCII") {
$result = $data = str_replace("\0", "", $data);
} else if($type=="URATIONAL" || $type=="SRATIONAL") {
$data = unRational($data,$type,$intel);
if($tag=="0204") { //DigitalZoom
$data=$data."x";
}
} else if($type=="USHORT" || $type=="SSHORT" || $type=="ULONG" || $type=="SLONG" || $type=="FLOAT" || $type=="DOUBLE") {
$data = rational($data,$type,$intel);
$result['RAWDATA'] = $data;
if($tag=="0001") { //first chunk
$result['Bytes']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//0
if ($result['Bytes'] != strlen($data) / 2) return $result; //Bad chunk
$result['Macro']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//1
switch($result['Macro']) {
case 1: $result['Macro'] = gettext("Macro"); break;
case 2: $result['Macro'] = gettext("Normal"); break;
default: $result['Macro'] = gettext("Unknown");
}
$result['SelfTimer']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//2
switch($result['SelfTimer']) {
case 0: $result['SelfTimer'] = gettext("Off"); break;
default: $result['SelfTimer'] .= gettext("/10s");
}
$result['Quality']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//3
switch($result['Quality']) {
case 2: $result['Quality'] = gettext("Normal"); break;
case 3: $result['Quality'] = gettext("Fine"); break;
case 5: $result['Quality'] = gettext("Superfine"); break;
default: $result['Quality'] = gettext("Unknown");
}
$result['Flash']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//4
switch($result['Flash']) {
case 0: $result['Flash'] = gettext("Off"); break;
case 1: $result['Flash'] = gettext("Auto"); break;
case 2: $result['Flash'] = gettext("On"); break;
case 3: $result['Flash'] = gettext("Red Eye Reduction"); break;
case 4: $result['Flash'] = gettext("Slow Synchro"); break;
case 5: $result['Flash'] = gettext("Auto + Red Eye Reduction"); break;
case 6: $result['Flash'] = gettext("On + Red Eye Reduction"); break;
case 16: $result['Flash'] = gettext("External Flash"); break;
default: $result['Flash'] = gettext("Unknown");
}
$result['DriveMode']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//5
switch($result['DriveMode']) {
case 0: $result['DriveMode'] = gettext("Single/Timer"); break;
case 1: $result['DriveMode'] = gettext("Continuous"); break;
default: $result['DriveMode'] = gettext("Unknown");
}
$result['Unknown']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//6
$result['FocusMode']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//7
switch($result['FocusMode']) {
case 0: $result['FocusMode'] = gettext("One-Shot"); break;
case 1: $result['FocusMode'] = gettext("AI Servo"); break;
case 2: $result['FocusMode'] = gettext("AI Focus"); break;
case 3: $result['FocusMode'] = gettext("Manual Focus"); break;
case 4: $result['FocusMode'] = gettext("Single"); break;
case 5: $result['FocusMode'] = gettext("Continuous"); break;
case 6: $result['FocusMode'] = gettext("Manual Focus"); break;
default: $result['FocusMode'] = gettext("Unknown");
}
$result['Unknown']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//8
$result['Unknown']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//9
$result['ImageSize']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//10
switch($result['ImageSize']) {
case 0: $result['ImageSize'] = gettext("Large"); break;
case 1: $result['ImageSize'] = gettext("Medium"); break;
case 2: $result['ImageSize'] = gettext("Small"); break;
default: $result['ImageSize'] = gettext("Unknown");
}
$result['EasyShooting']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//11
switch($result['EasyShooting']) {
case 0: $result['EasyShooting'] = gettext("Full Auto"); break;
case 1: $result['EasyShooting'] = gettext("Manual"); break;
case 2: $result['EasyShooting'] = gettext("Landscape"); break;
case 3: $result['EasyShooting'] = gettext("Fast Shutter"); break;
case 4: $result['EasyShooting'] = gettext("Slow Shutter"); break;
case 5: $result['EasyShooting'] = gettext("Night"); break;
case 6: $result['EasyShooting'] = gettext("Black & White"); break;
case 7: $result['EasyShooting'] = gettext("Sepia"); break;
case 8: $result['EasyShooting'] = gettext("Portrait"); break;
case 9: $result['EasyShooting'] = gettext("Sport"); break;
case 10: $result['EasyShooting'] = gettext("Macro/Close-Up"); break;
case 11: $result['EasyShooting'] = gettext("Pan Focus"); break;
default: $result['EasyShooting'] = gettext("Unknown");
}
$result['DigitalZoom']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//12
switch($result['DigitalZoom']) {
case 0:
case 65535: $result['DigitalZoom'] = gettext("None"); break;
case 1: $result['DigitalZoom'] = gettext("2x"); break;
case 2: $result['DigitalZoom'] = gettext("4x"); break;
default: $result['DigitalZoom'] = gettext("Unknown");
}
$result['Contrast']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//13
switch($result['Contrast']) {
case 0: $result['Contrast'] = gettext("Normal"); break;
case 1: $result['Contrast'] = gettext("High"); break;
case 65535: $result['Contrast'] = gettext("Low"); break;
default: $result['Contrast'] = gettext("Unknown");
}
$result['Saturation']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//14
switch($result['Saturation']) {
case 0: $result['Saturation'] = gettext("Normal"); break;
case 1: $result['Saturation'] = gettext("High"); break;
case 65535: $result['Saturation'] = gettext("Low"); break;
default: $result['Saturation'] = gettext("Unknown");
}
$result['Sharpness']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//15
switch($result['Sharpness']) {
case 0: $result['Sharpness'] = gettext("Normal"); break;
case 1: $result['Sharpness'] = gettext("High"); break;
case 65535: $result['Sharpness'] = gettext("Low"); break;
default: $result['Sharpness'] = gettext("Unknown");
}
$result['ISO']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//16
switch($result['ISO']) {
case 32767:
case 0: $result['ISO'] = isset($exif['SubIFD']['ISOSpeedRatings'])
? $exif['SubIFD']['ISOSpeedRatings'] : 'Unknown'; break;
case 15: $result['ISO'] = gettext("Auto"); break;
case 16: $result['ISO'] = gettext("50"); break;
case 17: $result['ISO'] = gettext("100"); break;
case 18: $result['ISO'] = gettext("200"); break;
case 19: $result['ISO'] = gettext("400"); break;
default: $result['ISO'] = gettext("Unknown");
}
$result['MeteringMode']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//17
switch($result['MeteringMode']) {
case 3: $result['MeteringMode'] = gettext("Evaluative"); break;
case 4: $result['MeteringMode'] = gettext("Partial"); break;
case 5: $result['MeteringMode'] = gettext("Center-weighted"); break;
default: $result['MeteringMode'] = gettext("Unknown");
}
$result['FocusType']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//18
switch($result['FocusType']) {
case 0: $result['FocusType'] = gettext("Manual"); break;
case 1: $result['FocusType'] = gettext("Auto"); break;
case 3: $result['FocusType'] = gettext("Close-up (Macro)"); break;
case 8: $result['FocusType'] = gettext("Locked (Pan Mode)"); break;
default: $result['FocusType'] = gettext("Unknown");
}
$result['AFPointSelected']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//19
switch($result['AFPointSelected']) {
case 12288: $result['AFPointSelected'] = gettext("Manual Focus"); break;
case 12289: $result['AFPointSelected'] = gettext("Auto Selected"); break;
case 12290: $result['AFPointSelected'] = gettext("Right"); break;
case 12291: $result['AFPointSelected'] = gettext("Center"); break;
case 12292: $result['AFPointSelected'] = gettext("Left"); break;
default: $result['AFPointSelected'] = gettext("Unknown");
}
$result['ExposureMode']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//20
switch($result['ExposureMode']) {
case 0: $result['ExposureMode'] = gettext("EasyShoot"); break;
case 1: $result['ExposureMode'] = gettext("Program"); break;
case 2: $result['ExposureMode'] = gettext("Tv"); break;
case 3: $result['ExposureMode'] = gettext("Av"); break;
case 4: $result['ExposureMode'] = gettext("Manual"); break;
case 5: $result['ExposureMode'] = gettext("Auto-DEP"); break;
default: $result['ExposureMode'] = gettext("Unknown");
}
$result['Unknown']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//21
$result['Unknown']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//22
$result['LongFocalLength']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//23
$result['LongFocalLength'] .= " focal units";
$result['ShortFocalLength']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//24
$result['ShortFocalLength'] .= " focal units";
$result['FocalUnits']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//25
$result['FocalUnits'] .= " per mm";
$result['Unknown']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//26
$result['Unknown']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//27
$result['FlashActivity']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//28
switch($result['FlashActivity']) {
case 0: $result['FlashActivity'] = gettext("Flash Did Not Fire"); break;
case 1: $result['FlashActivity'] = gettext("Flash Fired"); break;
default: $result['FlashActivity'] = gettext("Unknown");
}
$result['FlashDetails']=str_pad(base_convert(intel2Moto(substr($data,$place,4)), 16, 2), 16, "0", STR_PAD_LEFT);$place+=4;//29
$flashDetails = array();
if (substr($result['FlashDetails'], 1, 1) == 1) { $flashDetails[] = gettext('External E-TTL'); }
if (substr($result['FlashDetails'], 2, 1) == 1) { $flashDetails[] = gettext('Internal Flash'); }
if (substr($result['FlashDetails'], 4, 1) == 1) { $flashDetails[] = gettext('FP sync used'); }
if (substr($result['FlashDetails'], 8, 1) == 1) { $flashDetails[] = gettext('2nd(rear)-curtain sync used'); }
if (substr($result['FlashDetails'], 12, 1) == 1) { $flashDetails[] = gettext('1st curtain sync'); }
$result['FlashDetails']=implode(",", $flashDetails);
$result['Unknown']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//30
$result['Unknown']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//31
$anotherFocusMode=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//32
if(strpos(strtoupper($exif['IFD0']['Model']), "G1") !== false) {
switch($anotherFocusMode) {
case 0: $result['FocusMode'] = gettext("Single"); break;
case 1: $result['FocusMode'] = gettext("Continuous"); break;
default: $result['FocusMode'] = gettext("Unknown");
}
}
} else if($tag=="0004") { //second chunk
$result['Bytes']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//0
if ($result['Bytes'] != strlen($data) / 2) return $result; //Bad chunk
$result['Unknown']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//1
$result['Unknown']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//2
$result['Unknown']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//3
$result['Unknown']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//4
$result['Unknown']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//5
$result['Unknown']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//6
$result['WhiteBalance']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//7
switch($result['WhiteBalance']) {
case 0: $result['WhiteBalance'] = gettext("Auto"); break;
case 1: $result['WhiteBalance'] = gettext("Sunny"); break;
case 2: $result['WhiteBalance'] = gettext("Cloudy"); break;
case 3: $result['WhiteBalance'] = gettext("Tungsten"); break;
case 4: $result['WhiteBalance'] = gettext("Fluorescent"); break;
case 5: $result['WhiteBalance'] = gettext("Flash"); break;
case 6: $result['WhiteBalance'] = gettext("Custom"); break;
default: $result['WhiteBalance'] = gettext("Unknown");
}
$result['Unknown']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//8
$result['SequenceNumber']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//9
$result['Unknown']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//10
$result['Unknown']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//11
$result['Unknown']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//12
$result['Unknown']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//13
$result['AFPointUsed']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//14
$afPointUsed = array();
if ($result['AFPointUsed'] & 0x0001) $afPointUsed[] = gettext("Right"); //bit 0
if ($result['AFPointUsed'] & 0x0002) $afPointUsed[] = gettext("Center"); //bit 1
if ($result['AFPointUsed'] & 0x0004) $afPointUsed[] = gettext("Left"); //bit 2
if ($result['AFPointUsed'] & 0x0800) $afPointUsed[] = gettext("12"); //bit 12
if ($result['AFPointUsed'] & 0x1000) $afPointUsed[] = gettext("13"); //bit 13
if ($result['AFPointUsed'] & 0x2000) $afPointUsed[] = gettext("14"); //bit 14
if ($result['AFPointUsed'] & 0x4000) $afPointUsed[] = gettext("15"); //bit 15
$result['AFPointUsed'] = implode(",", $afPointUsed);
$result['FlashBias']=intel2Moto(substr($data,$place,4));$place+=4;//15
switch($result['FlashBias']) {
case 'ffc0': $result['FlashBias'] = "-2 EV"; break;
case 'ffcc': $result['FlashBias'] = "-1.67 EV"; break;
case 'ffd0': $result['FlashBias'] = "-1.5 EV"; break;
case 'ffd4': $result['FlashBias'] = "-1.33 EV"; break;
case 'ffe0': $result['FlashBias'] = "-1 EV"; break;
case 'ffec': $result['FlashBias'] = "-0.67 EV"; break;
case 'fff0': $result['FlashBias'] = "-0.5 EV"; break;
case 'fff4': $result['FlashBias'] = "-0.33 EV"; break;
case '0000': $result['FlashBias'] = "0 EV"; break;
case '000c': $result['FlashBias'] = "0.33 EV"; break;
case '0010': $result['FlashBias'] = "0.5 EV"; break;
case '0014': $result['FlashBias'] = "0.67 EV"; break;
case '0020': $result['FlashBias'] = "1 EV"; break;
case '002c': $result['FlashBias'] = "1.33 EV"; break;
case '0030': $result['FlashBias'] = "1.5 EV"; break;
case '0034': $result['FlashBias'] = "1.67 EV"; break;
case '0040': $result['FlashBias'] = "2 EV"; break;
default: $result['FlashBias'] = gettext("Unknown");
}
$result['Unknown']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//16
$result['Unknown']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//17
$result['Unknown']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//18
$result['SubjectDistance']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//19
$result['SubjectDistance'] .= "/100 m";
} else if($tag=="0008") { //image number
if($intel==1) $data = intel2Moto($data);
$data=hexdec($data);
$result = round($data/10000)."-".$data%10000;
} else if($tag=="000c") { //camera serial number
if($intel==1) $data = intel2Moto($data);
$data=hexdec($data);
$result = "#".bin2hex(substr($data,0,16)).substr($data,16,16);
}
} else if($type=="UNDEFINED") {
} else {
$data = bin2hex($data);
if($intel==1) $data = intel2Moto($data);
}
return $data;
}
//=================
// Cannon Special data section
// Useful: http://www.burren.cx/david/canon.html
// http://www.burren.cx/david/canon.html
// http://www.ozhiker.com/electronics/pjmt/jpeg_info/canon_mn.html
//====================================================================
function parseCanon($block,&$result,$seek, $globalOffset) {
$place = 0; //current place
if($result['Endien']=="Intel") $intel=1;
else $intel=0;
$model = $result['IFD0']['Model'];
//Get number of tags (2 bytes)
$num = bin2hex(substr($block,$place,2));$place+=2;
if($intel==1) $num = intel2Moto($num);
$result['SubIFD']['MakerNote']['MakerNoteNumTags'] = hexdec($num);
//loop thru all tags Each field is 12 bytes
for($i=0;$i<hexdec($num);$i++) {
//2 byte tag
$tag = bin2hex(substr($block,$place,2));$place+=2;
if($intel==1) $tag = intel2Moto($tag);
$tag_name = lookup_Canon_tag($tag);
//2 byte type
$type = bin2hex(substr($block,$place,2));$place+=2;
if($intel==1) $type = intel2Moto($type);
lookup_type($type,$size);
//4 byte count of number of data units
$count = bin2hex(substr($block,$place,4));$place+=4;
if($intel==1) $count = intel2Moto($count);
$bytesofdata = validSize($size*hexdec($count));
if($bytesofdata<=0) {
return; //if this value is 0 or less then we have read all the tags we can
}
//4 byte value of data or pointer to data
$value = substr($block,$place,4);$place+=4;
if($bytesofdata<=4) {
$data = substr($value,0,$bytesofdata);
} else {
$value = bin2hex($value);
if($intel==1) $value = intel2Moto($value);
$v = fseek($seek,$globalOffset+hexdec($value)); //offsets are from TIFF header which is 12 bytes from the start of the file
if (isset($GLOBALS['exiferFileSize'])) {
$exiferFileSize = $GLOBALS['exiferFileSize'];
} else {
$exiferFileSize = 0;
}
if($v==0 && $bytesofdata < $exiferFileSize) {
$data = fread($seek, $bytesofdata);
} else if($v==-1) {
$result['Errors'] = $result['Errors']++;
$data = '';
} else {
$data = '';
}
}
$result['SubIFD']['MakerNote'][$tag_name] = ''; // insure the index exists
$formated_data = formatCanonData($type,$tag,$intel,$data,$result,$result['SubIFD']['MakerNote'][$tag_name]);
if($result['VerboseOutput']==1) {
//$result['SubIFD']['MakerNote'][$tag_name] = $formated_data;
if($type=="URATIONAL" || $type=="SRATIONAL" || $type=="USHORT" || $type=="SSHORT" || $type=="ULONG" || $type=="SLONG" || $type=="FLOAT" || $type=="DOUBLE") {
$data = bin2hex($data);
if($intel==1) $data = intel2Moto($data);
}
$result['SubIFD']['MakerNote'][$tag_name."_Verbose"]['RawData'] = $data;
$result['SubIFD']['MakerNote'][$tag_name."_Verbose"]['Type'] = $type;
$result['SubIFD']['MakerNote'][$tag_name."_Verbose"]['Bytes'] = $bytesofdata;
} else {
//$result['SubIFD']['MakerNote'][$tag_name] = $formated_data;
}
}
}
?>

247
-child/exifer/makers/fujifilm.php Executable file
View File

@@ -0,0 +1,247 @@
<?php //================================================================================================
//================================================================================================
//================================================================================================
/*
Exifer
Extracts EXIF information from digital photos.
Copyright <20> 2003 Jake Olefsky
http://www.offsky.com/software/exif/index.php
jake@olefsky.com
Please see exif.php for the complete information about this software.
------------
This program is free software; you can redistribute it and/or modify it under the terms of
the GNU General Public License as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. http://www.gnu.org/copyleft/gpl.html
*/
//================================================================================================
//================================================================================================
//================================================================================================
//=================
// Looks up the name of the tag for the MakerNote (Depends on Manufacturer)
//====================================================================
function lookup_Fujifilm_tag($tag) {
switch($tag) {
case "0000": $tag = "Version";break;
case "1000": $tag = "Quality";break;
case "1001": $tag = "Sharpness";break;
case "1002": $tag = "WhiteBalance";break;
case "1003": $tag = "Color";break;
case "1004": $tag = "Tone";break;
case "1010": $tag = "FlashMode";break;
case "1011": $tag = "FlashStrength";break;
case "1020": $tag = "Macro";break;
case "1021": $tag = "FocusMode";break;
case "1030": $tag = "SlowSync";break;
case "1031": $tag = "PictureMode";break;
case "1100": $tag = "ContinuousTakingBracket";break;
case "1200": $tag = "Unknown";break;
case "1300": $tag = "BlurWarning";break;
case "1301": $tag = "FocusWarning";break;
case "1302": $tag = "AEWarning";break;
default: $tag = "unknown:".$tag;break;
}
return $tag;
}
//=================
// Formats Data for the data type
//====================================================================
function formatFujifilmData($type,$tag,$intel,$data) {
if($type=="ASCII") {
} else if($type=="URATIONAL" || $type=="SRATIONAL") {
$data = unRational($data,$type,$intel);
if($tag=="1011") { //FlashStrength
$data=$data." EV";
}
} else if($type=="USHORT" || $type=="SSHORT" || $type=="ULONG" || $type=="SLONG" || $type=="FLOAT" || $type=="DOUBLE") {
$data =rational($data,$type,$intel);
if($tag=="1001") { //Sharpness
if($data == 1) $data = gettext("Soft");
else if($data == 2) $data = gettext("Soft");
else if($data == 3) $data = gettext("Normal");
else if($data == 4) $data = gettext("Hard");
else if($data == 5) $data = gettext("Hard");
else $data = gettext("Unknown").": ".$data;
}
if($tag=="1002") { //WhiteBalance
if($data == 0) $data = gettext("Auto");
else if($data == 256) $data = gettext("Daylight");
else if($data == 512) $data = gettext("Cloudy");
else if($data == 768) $data = gettext("DaylightColor-fluorescence");
else if($data == 769) $data = gettext("DaywhiteColor-fluorescence");
else if($data == 770) $data = gettext("White-fluorescence");
else if($data == 1024) $data = gettext("Incandescence");
else if($data == 3840) $data = gettext("Custom");
else $data = gettext("Unknown").": ".$data;
}
if($tag=="1003") { //Color
if($data == 0) $data = gettext("Chroma Saturation Normal(STD)");
else if($data == 256) $data = gettext("Chroma Saturation High");
else if($data == 512) $data = gettext("Chroma Saturation Low(ORG)");
else $data = gettext("Unknown: ").$data;
}
if($tag=="1004") { //Tone
if($data == 0) $data = gettext("Contrast Normal(STD)");
else if($data == 256) $data = gettext("Contrast High(HARD)");
else if($data == 512) $data = gettext("Contrast Low(ORG)");
else $data = gettext("Unknown: ").$data;
}
if($tag=="1010") { //FlashMode
if($data == 0) $data = gettext("Auto");
else if($data == 1) $data = gettext("On");
else if($data == 2) $data = gettext("Off");
else if($data == 3) $data = gettext("Red-Eye Reduction");
else $data = gettext("Unknown: ").$data;
}
if($tag=="1020") { //Macro
if($data == 0) $data = gettext("Off");
else if($data == 1) $data = gettext("On");
else $data = gettext("Unknown: ").$data;
}
if($tag=="1021") { //FocusMode
if($data == 0) $data = gettext("Auto");
else if($data == 1) $data = gettext("Manual");
else $data = gettext("Unknown: ").$data;
}
if($tag=="1030") { //SlowSync
if($data == 0) $data = gettext("Off");
else if($data == 1) $data = gettext("On");
else $data = gettext("Unknown: ").$data;
}
if($tag=="1031") { //PictureMode
if($data == 0) $data = gettext("Auto");
else if($data == 1) $data = gettext("Portrait");
else if($data == 2) $data = gettext("Landscape");
else if($data == 4) $data = gettext("Sports");
else if($data == 5) $data = gettext("Night");
else if($data == 6) $data = gettext("Program AE");
else if($data == 256) $data = gettext("Aperture Priority AE");
else if($data == 512) $data = gettext("Shutter Priority");
else if($data == 768) $data = gettext("Manual Exposure");
else $data = gettext("Unknown: ").$data;
}
if($tag=="1100") { //ContinuousTakingBracket
if($data == 0) $data = gettext("Off");
else if($data == 1) $data = gettext("On");
else $data = gettext("Unknown: ").$data;
}
if($tag=="1300") { //BlurWarning
if($data == 0) $data = gettext("No Warning");
else if($data == 1) $data = gettext("Warning");
else $data = gettext("Unknown: ").$data;
}
if($tag=="1301") { //FocusWarning
if($data == 0) $data = gettext("Auto Focus Good");
else if($data == 1) $data = gettext("Out of Focus");
else $data = gettext("Unknown: ").$data;
}
if($tag=="1302") { //AEWarning
if($data == 0) $data = gettext("AE Good");
else if($data == 1) $data = gettext("Over Exposure");
else $data = gettext("Unknown: ").$data;
}
} else if($type=="UNDEFINED") {
} else {
$data = bin2hex($data);
if($intel==1) $data = intel2Moto($data);
}
return $data;
}
//=================
// Fujifilm Special data section
//====================================================================
function parseFujifilm($block,&$result) {
//if($result['Endien']=="Intel") $intel=1;
//else $intel=0;
$intel=1;
$model = $result['IFD0']['Model'];
$place=8; //current place
$offset=8;
$num = bin2hex(substr($block,$place,4));$place+=4;
if($intel==1) $num = intel2Moto($num);
$result['SubIFD']['MakerNote']['Offset'] = hexdec($num);
//Get number of tags (2 bytes)
$num = bin2hex(substr($block,$place,2));$place+=2;
if($intel==1) $num = intel2Moto($num);
$result['SubIFD']['MakerNote']['MakerNoteNumTags'] = hexdec($num);
//loop thru all tags Each field is 12 bytes
for($i=0;$i<hexdec($num);$i++) {
//2 byte tag
$tag = bin2hex(substr($block,$place,2));$place+=2;
if($intel==1) $tag = intel2Moto($tag);
$tag_name = lookup_Fujifilm_tag($tag);
//2 byte type
$type = bin2hex(substr($block,$place,2));$place+=2;
if($intel==1) $type = intel2Moto($type);
lookup_type($type,$size);
//4 byte count of number of data units
$count = bin2hex(substr($block,$place,4));$place+=4;
if($intel==1) $count = intel2Moto($count);
$bytesofdata = validSize($size*hexdec($count));
//4 byte value of data or pointer to data
$value = substr($block,$place,4);$place+=4;
if($bytesofdata<=4) {
$data = substr($value,0,$bytesofdata);
} else {
$value = bin2hex($value);
if($intel==1) $value = intel2Moto($value);
$data = substr($block,hexdec($value)-$offset,$bytesofdata*2);
}
$formated_data = formatFujifilmData($type,$tag,$intel,$data);
if($result['VerboseOutput']==1) {
$result['SubIFD']['MakerNote'][$tag_name] = $formated_data;
if($type=="URATIONAL" || $type=="SRATIONAL" || $type=="USHORT" || $type=="SSHORT" || $type=="ULONG" || $type=="SLONG" || $type=="FLOAT" || $type=="DOUBLE") {
$data = bin2hex($data);
if($intel==1) $data = intel2Moto($data);
}
$result['SubIFD']['MakerNote'][$tag_name."_Verbose"]['RawData'] = $data;
$result['SubIFD']['MakerNote'][$tag_name."_Verbose"]['Type'] = $type;
$result['SubIFD']['MakerNote'][$tag_name."_Verbose"]['Bytes'] = $bytesofdata;
} else {
$result['SubIFD']['MakerNote'][$tag_name] = $formated_data;
}
}
}
?>

218
-child/exifer/makers/gps.php Executable file
View File

@@ -0,0 +1,218 @@
<?php //================================================================================================
//================================================================================================
//================================================================================================
/*
Exifer
Extracts EXIF information from digital photos.
Copyright © 2003 Jake Olefsky
http://www.offsky.com/software/exif/index.php
jake@olefsky.com
Please see exif.php for the complete information about this software.
------------
This program is free software; you can redistribute it and/or modify it under the terms of
the GNU General Public License as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. http://www.gnu.org/copyleft/gpl.html
*/
//================================================================================================
//================================================================================================
//================================================================================================
//=================
// Looks up the name of the tag
//====================================================================
function lookup_GPS_tag($tag) {
switch($tag) {
case "0000": $tag = "Version";break;
case "0001": $tag = "Latitude Reference";break; //north or south
case "0002": $tag = "Latitude";break; //dd mm.mm or dd mm ss
case "0003": $tag = "Longitude Reference";break; //east or west
case "0004": $tag = "Longitude";break; //dd mm.mm or dd mm ss
case "0005": $tag = "Altitude Reference";break; //sea level or below sea level
case "0006": $tag = "Altitude";break; //positive rational number
case "0007": $tag = "Time";break; //three positive rational numbers
case "0008": $tag = "Satellite";break; //text string up to 999 bytes long
case "0009": $tag = "ReceiveStatus";break; //in progress or interop
case "000a": $tag = "MeasurementMode";break; //2D or 3D
case "000b": $tag = "MeasurementPrecision";break; //positive rational number
case "000c": $tag = "SpeedUnit";break; //KPH, MPH, knots
case "000d": $tag = "ReceiverSpeed";break; //positive rational number
case "000e": $tag = "MovementDirectionRef";break; //true or magnetic north
case "000f": $tag = "MovementDirection";break; //positive rational number
case "0010": $tag = "ImageDirectionRef";break; //true or magnetic north
case "0011": $tag = "ImageDirection";break; //positive rational number
case "0012": $tag = "GeodeticSurveyData";break; //text string up to 999 bytes long
case "0013": $tag = "DestLatitudeRef";break; //north or south
case "0014": $tag = "DestinationLatitude";break; //three positive rational numbers
case "0015": $tag = "DestLongitudeRef";break; //east or west
case "0016": $tag = "DestinationLongitude";break; //three positive rational numbers
case "0017": $tag = "DestBearingRef";break; //true or magnetic north
case "0018": $tag = "DestinationBearing";break; //positive rational number
case "0019": $tag = "DestDistanceRef";break; //km, miles, knots
case "001a": $tag = "DestinationDistance";break; //positive rational number
case "001b": $tag = "ProcessingMethod";break;
case "001c": $tag = "AreaInformation";break;
case "001d": $tag = "Datestamp";break; //text string 10 bytes long
case "001e": $tag = "DifferentialCorrection";break; //integer in range 0-65535
default: $tag = "unknown:".$tag;break;
}
return $tag;
}
//=================
// Formats Data for the data type
//====================================================================
function formatGPSData($type,$tag,$intel,$data) {
if($type=="ASCII") {
if($tag=="0001" || $tag=="0003"){ // Latitude Reference, Longitude Reference
$data = ($data{1} == @$data{2} && @$data{1} == @$data{3}) ? $data{0} : $data;
}
} else if($type=="URATIONAL" || $type=="SRATIONAL") {
if($tag=="0002" || $tag=="0004" || $tag=='0007') { //Latitude, Longitude, Time
$datum = array();
for ($i=0;$i<strlen($data);$i=$i+8) {
array_push($datum,substr($data, $i, 8));
}
$hour = unRational($datum[0],$type,$intel);
$minutes = unRational($datum[1],$type,$intel);
$seconds = unRational($datum[2],$type,$intel);
if($tag=="0007") { //Time
$data = $hour.":".$minutes.":".$seconds;
} else {
$data = $hour+$minutes/60+$seconds/3600;
}
} else {
$data = unRational($data,$type,$intel);
if($tag=="0006"){
$data .= 'm';
}
}
} else if($type=="USHORT" || $type=="SSHORT" || $type=="ULONG" || $type=="SLONG" || $type=="FLOAT" || $type=="DOUBLE") {
$data = rational($data,$type,$intel);
} else if($type=="UNDEFINED") {
} else if($type=="UBYTE") {
$data = bin2hex($data);
if($intel==1) $num = intel2Moto($data);
if($tag=="0000") { // VersionID
$data = hexdec(substr($data,0,2)) .
".". hexdec(substr($data,2,2)) .
".". hexdec(substr($data,4,2)) .
".". hexdec(substr($data,6,2));
} else if($tag=="0005"){ // Altitude Reference
if($data == "00000000"){ $data = '+'; }
else if($data == "01000000"){ $data = '-'; }
}
} else {
$data = bin2hex($data);
if($intel==1) $data = intel2Moto($data);
}
return $data;
}
//=================
// GPS Special data section
// Useful websites
// http://drewnoakes.com/code/exif/sampleOutput.html
// http://www.geosnapper.com
//====================================================================
function parseGPS($block,&$result,$offset,$seek, $globalOffset) {
if($result['Endien']=="Intel") $intel=1;
else $intel=0;
$v = fseek($seek,$globalOffset+$offset); //offsets are from TIFF header which is 12 bytes from the start of the file
if($v==-1) {
$result['Errors'] = $result['Errors']++;
}
$num = bin2hex(fread( $seek, 2 ));
if($intel==1) $num = intel2Moto($num);
$num=hexdec($num);
$result['GPS']['NumTags'] = $num;
if ($num == 0) {
return;
}
$block = fread( $seek, $num*12 );
$place = 0;
//loop thru all tags Each field is 12 bytes
for($i=0;$i<$num;$i++) {
//2 byte tag
$tag = bin2hex(substr($block,$place,2));$place+=2;
if($intel==1) $tag = intel2Moto($tag);
$tag_name = lookup_GPS_tag($tag);
//2 byte datatype
$type = bin2hex(substr($block,$place,2));$place+=2;
if($intel==1) $type = intel2Moto($type);
lookup_type($type,$size);
//4 byte number of elements
$count = bin2hex(substr($block,$place,4));$place+=4;
if($intel==1) $count = intel2Moto($count);
$bytesofdata = validSize($size*hexdec($count));
//4 byte value or pointer to value if larger than 4 bytes
$value = substr($block,$place,4);$place+=4;
if($bytesofdata<=4) {
$data = substr($value,0,$bytesofdata);
} else {
if (strpos('unknown',$tag_name) !== false || $bytesofdata > 1024) {
$result['Errors'] = $result['Errors']++;
$data = '';
$type = 'ASCII';
} else {
$value = bin2hex($value);
if($intel==1) $value = intel2Moto($value);
$v = fseek($seek,$globalOffset+hexdec($value)); //offsets are from TIFF header which is 12 bytes from the start of the file
if($v==0) {
$data = fread($seek, $bytesofdata);
} else {
$result['Errors'] = $result['Errors']++;
$data = '';
$type = 'ASCII';
}
}
}
if($result['VerboseOutput']==1) {
$result['GPS'][$tag_name] = formatGPSData($type,$tag,$intel,$data);
$result['GPS'][$tag_name."_Verbose"]['RawData'] = bin2hex($data);
$result['GPS'][$tag_name."_Verbose"]['Type'] = $type;
$result['GPS'][$tag_name."_Verbose"]['Bytes'] = $bytesofdata;
} else {
$result['GPS'][$tag_name] = formatGPSData($type,$tag,$intel,$data);
}
}
}
?>

411
-child/exifer/makers/nikon.php Executable file
View File

@@ -0,0 +1,411 @@
<?php //================================================================================================
//================================================================================================
//================================================================================================
/*
Exifer
Extracts EXIF information from digital photos.
Copyright <20> 2003 Jake Olefsky
http://www.offsky.com/software/exif/index.php
jake@olefsky.com
Please see exif.php for the complete information about this software.
------------
This program is free software; you can redistribute it and/or modify it under the terms of
the GNU General Public License as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. http://www.gnu.org/copyleft/gpl.html
*/
//================================================================================================
//================================================================================================
//================================================================================================
//=================
// Looks up the name of the tag for the MakerNote (Depends on Manufacturer)
//====================================================================
function lookup_Nikon_tag($tag,$model) {
if($model==0) {
switch($tag) {
case "0003": $tag = "Quality";break;
case "0004": $tag = "ColorMode";break;
case "0005": $tag = "ImageAdjustment";break;
case "0006": $tag = "CCDSensitivity";break;
case "0007": $tag = "WhiteBalance";break;
case "0008": $tag = "Focus";break;
case "0009": $tag = "Unknown2";break;
case "000a": $tag = "DigitalZoom";break;
case "000b": $tag = gettext("Converter");break;
default: $tag = "unknown:".$tag;break;
}
} else if($model==1) {
switch($tag) {
case "0002": $tag = "ISOSetting";break;
case "0003": $tag = "ColorMode";break;
case "0004": $tag = "Quality";break;
case "0005": $tag = "Whitebalance";break;
case "0006": $tag = "ImageSharpening";break;
case "0007": $tag = "FocusMode";break;
case "0008": $tag = "FlashSetting";break;
case "0009": $tag = "FlashMode";break;
case "000b": $tag = "WhiteBalanceFine";break;
case "000c": $tag = "WB_RBLevels";break;
case "000d": $tag = "ProgramShift";break;
case "000e": $tag = "ExposureDifference";break;
case "000f": $tag = "ISOSelection";break;
case "0010": $tag = "DataDump";break;
case "0011": $tag = "NikonPreview";break;
case "0012": $tag = "FlashExposureComp";break;
case "0013": $tag = "ISOSetting2";break;
case "0014": $tag = "ColorBalanceA";break;
case "0016": $tag = "ImageBoundary";break;
case "0017": $tag = "FlashExposureComp";break;
case "0018": $tag = "FlashExposureBracketValue";break;
case "0019": $tag = "ExposureBracketValue";break;
case "001a": $tag = "ImageProcessing";break;
case "001b": $tag = "CropHiSpeed";break;
case "001c": $tag = "ExposureTuning";break;
case "001d": $tag = "SerialNumber";break;
case "001e": $tag = "ColorSpace";break;
case "001f": $tag = "VRInfo";break;
case "0020": $tag = "ImageAuthentication";break;
case "0022": $tag = "ActiveD-Lighting";break;
case "0023": $tag = "PictureControl";break;
case "0024": $tag = "WorldTime";break;
case "0025": $tag = "ISOInfo";break;
case "002a": $tag = "VignetteControl";break;
case "002b": $tag = "DistortInfo";break;
case "0080": $tag = "ImageAdjustment";break;
case "0081": $tag = "ToneCompensation";break;
case "0082": $tag = "Adapter";break;
case "0083": $tag = "LensType";break;
case "0084": $tag = "LensInfo";break;
case "0085": $tag = "ManualFocusDistance";break;
case "0086": $tag = "DigitalZoom";break;
case "0087": $tag = "FlashUsed";break;
case "0088": $tag = "AFFocusPosition";break;
case "0089": $tag = "ShootingMode";break;
case "008b": $tag = "LensFStops";break;
case "008c": $tag = "ContrastCurve";break;
case "008d": $tag = "ColorMode";break;
case "0090": $tag = "LightType";break;
case "0092": $tag = "HueAdjustment";break;
case "0093": $tag = "NEFCompression";break;
case "0094": $tag = "Saturation";break;
case "0095": $tag = "NoiseReduction";break;
case "009a": $tag = "SensorPixelSize";break;
default: $tag = "unknown:".$tag;break;
}
}
return $tag;
}
//=================
// Formats Data for the data type
//====================================================================
function formatNikonData($type,$tag,$intel,$model,$data) {
switch ($type) {
case "ASCII":
break; // do nothing!
case "URATIONAL":
case"SRATIONAL":
switch ($tag) {
case '0084': // LensInfo
$minFL = unRational(substr($data,0,8),$type,$intel);
$maxFL = unRational(substr($data,8,8),$type,$intel);
$minSP = unRational(substr($data,16,8),$type,$intel);
$maxSP = unRational(substr($data,24,8),$type,$intel);
if ($minFL == $maxFL) {
$data = sprintf('%0.0fmm f/%0.1f',$minFL,$minSP);
} elseif ($minSP == $maxSP) {
$data = sprintf('%0.0f-%0.0fmm f/%0.1f',$minFL,$maxFL,$minSP);
} else {
$data = sprintf('%0.0f-%0.0fmm f/%0.1f-%0.1f',$minFL,$maxFL,$minSP,$maxSP);
}
break;
case "0085":
if ($model==1) $data=unRational($data,$type,$intel)." m"; //ManualFocusDistance
break;
case "0086":
if ($model==1) $data=unRational($data,$type,$intel)."x"; //DigitalZoom
break;
case "000a":
if ($model==0) $data=unRational($data,$type,$intel)."x"; //DigitalZoom
break;
default:
$data=unRational($data,$type,$intel);
break;
}
break;
case "USHORT":
case $type=="SSHORT":
case $type=="ULONG":
case $type=="SLONG":
case $type=="FLOAT":
case $type=="DOUBLE":
$data = rational($data,$type,$intel);
switch ($tag) {
case "0003":
if ($model==0) { //Quality
switch ($data) {
case 1: $data = gettext("VGA Basic"); break;
case 2: $data = gettext("VGA Normal"); break;
case 3: $data = gettext("VGA Fine"); break;
case 4: $data = gettext("SXGA Basic"); break;
case 5: $data = gettext("SXGA Normal"); break;
case 6: $data = gettext("SXGA Fine"); break;
default: $data = gettext("Unknown").": ".$data; break;
}
}
break;
case "0004":
if ($model==0) { //Color
switch ($data) {
case 1: $data = gettext("Color"); break;
case 2: $data = gettext("Monochrome"); break;
default: $data = gettext("Unknown").": ".$data; break;
}
}
break;
case "0005":
if ($model==0) { //Image Adjustment
switch ($data) {
case 0: $data = gettext("Normal"); break;
case 1: $data = gettext("Bright+"); break;
case 2: $data = gettext("Bright-"); break;
case 3: $data = gettext("Contrast+"); break;
case 4: $data = gettext("Contrast-"); break;
default: $data = gettext("Unknown").": ".$data; break;
}
}
break;
case "0006":
if ($model==0) { //CCD Sensitivity
switch($data) {
case 0: $data = "ISO-80"; break;
case 2: $data = "ISO-160"; break;
case 4: $data = "ISO-320"; break;
case 5: $data = "ISO-100"; break;
default: $data = gettext("Unknown").": ".$data; break;
}
}
break;
case "0007":
if ($model==0) { //White Balance
switch ($data) {
case 0: $data = gettext("Auto"); break;
case 1: $data = gettext("Preset"); break;
case 2: $data = gettext("Daylight"); break;
case 3: $data = gettext("Incandescence"); break;
case 4: $data = gettext("Fluorescence"); break;
case 5: $data = gettext("Cloudy"); break;
case 6: $data = gettext("SpeedLight"); break;
default: $data = gettext("Unknown").": ".$data; break;
}
}
break;
case "000b":
if ($model==0) { //Converter
switch ($data) {
case 0: $data = gettext("None"); break;
case 1: $data = gettext("Fisheye"); break;
default: $data = gettext("Unknown").": ".$data; break;
}
}
break;
}
break;
case "UNDEFINED":
switch ($tag) {
case "0001":
if ($model==1) $data=$data/100; break; //Unknown (Version?)
break;
case "0088":
if ($model==1) { //AF Focus Position
$temp = gettext("Center");
$data = bin2hex($data);
$data = str_replace("01","Top",$data);
$data = str_replace("02","Bottom",$data);
$data = str_replace("03","Left",$data);
$data = str_replace("04","Right",$data);
$data = str_replace("00","",$data);
if(strlen($data)==0) $data = $temp;
}
break;
}
break;
default:
$data = bin2hex($data);
if($intel==1) $data = intel2Moto($data);
switch ($tag) {
case "0083":
if ($model==1) { //Lens Type
$data = hexdec(substr($data,0,2));
switch ($data) {
case 0: $data = gettext("AF non D"); break;
case 1: $data = gettext("Manual"); break;
case 2: $data = "AF-D or AF-S"; break;
case 6: $data = "AF-D G"; break;
case 10: $data = "AF-D VR"; break;
case 14: $data = "AF-D G VR"; break;
default: $data = gettext("Unknown").": ".$data; break;
}
}
break;
case "0087":
if ($model==1) { //Flash type
$data = hexdec(substr($data,0,2));
if($data == 0) $data = gettext("Did Not Fire");
else if($data == 4) $data = gettext("Unknown");
else if($data == 7) $data = gettext("External");
else if($data == 9) $data = gettext("On Camera");
else $data = gettext("Unknown").": ".$data;
}
break;
}
break;
}
return $data;
}
//=================
// Nikon Special data section
//====================================================================
function parseNikon($block,&$result) {
if($result['Endien']=="Intel") $intel=1;
else $intel=0;
$model = $result['IFD0']['Model'];
//these 6 models start with "Nikon". Other models dont.
if($model=="E700\0" || $model=="E800\0" || $model=="E900\0" || $model=="E900S\0" || $model=="E910\0" || $model=="E950\0") {
$place=8; //current place
$model = 0;
//Get number of tags (2 bytes)
$num = bin2hex(substr($block,$place,2));$place+=2;
if($intel==1) $num = intel2Moto($num);
$result['SubIFD']['MakerNote']['MakerNoteNumTags'] = hexdec($num);
//loop thru all tags Each field is 12 bytes
for($i=0;$i<hexdec($num);$i++) {
//2 byte tag
$tag = bin2hex(substr($block,$place,2));$place+=2;
if($intel==1) $tag = intel2Moto($tag);
$tag_name = lookup_Nikon_tag($tag, $model);
//2 byte type
$type = bin2hex(substr($block,$place,2));$place+=2;
if($intel==1) $type = intel2Moto($type);
lookup_type($type,$size);
//4 byte count of number of data units
$count = bin2hex(substr($block,$place,4));$place+=4;
if($intel==1) $count = intel2Moto($count);
$bytesofdata = validSize($size*hexdec($count));
//4 byte value of data or pointer to data
$value = substr($block,$place,4);$place+=4;
//if tag is 0002 then its the ASCII value which we know is at 140 so calc offset
//THIS HACK ONLY WORKS WITH EARLY NIKON MODELS
if($tag=="0002") $offset = hexdec($value)-140;
if($bytesofdata<=4) {
$data = substr($value,0,$bytesofdata);
} else {
$value = bin2hex($value);
if($intel==1) $value = intel2Moto($value);
$data = substr($block,hexdec($value)-$offset,$bytesofdata*2);
}
$formated_data = formatNikonData($type,$tag,$intel,$model,$data);
if($result['VerboseOutput']==1) {
$result['SubIFD']['MakerNote'][$tag_name] = $formated_data;
$result['SubIFD']['MakerNote'][$tag_name."_Verbose"]['RawData'] = $data;
$result['SubIFD']['MakerNote'][$tag_name."_Verbose"]['Type'] = $type;
$result['SubIFD']['MakerNote'][$tag_name."_Verbose"]['Bytes'] = $bytesofdata;
} else {
$result['SubIFD']['MakerNote'][$tag_name] = $formated_data;
}
}
} else {
$place=0;//current place
$model = 1;
$nikon = substr($block,$place,8);$place+=8;
$endien = substr($block,$place,4);$place+=4;
//2 bytes of 0x002a
$tag = bin2hex(substr($block,$place,2));$place+=2;
//Then 4 bytes of offset to IFD0 (usually 8 which includes all 8 bytes of TIFF header)
$offset = bin2hex(substr($block,$place,4));$place+=4;
if($intel==1) $offset = intel2Moto($offset);
if(hexdec($offset)>8) $place+=$offset-8;
//Get number of tags (2 bytes)
$num = bin2hex(substr($block,$place,2));$place+=2;
if($intel==1) $num = intel2Moto($num);
//loop thru all tags Each field is 12 bytes
for($i=0;$i<hexdec($num);$i++) {
//2 byte tag
$tag = bin2hex(substr($block,$place,2));$place+=2;
if($intel==1) $tag = intel2Moto($tag);
$tag_name = lookup_Nikon_tag($tag, $model);
//2 byte type
$type = bin2hex(substr($block,$place,2));$place+=2;
if($intel==1) $type = intel2Moto($type);
lookup_type($type,$size);
//4 byte count of number of data units
$count = bin2hex(substr($block,$place,4));$place+=4;
if($intel==1) $count = intel2Moto($count);
$bytesofdata = validSize($size*hexdec($count));
//4 byte value of data or pointer to data
$value = substr($block,$place,4);$place+=4;
if($bytesofdata<=4) {
$data = substr($value,0,$bytesofdata);
} else {
$value = bin2hex($value);
if($intel==1) $value = intel2Moto($value);
$data = substr($block,hexdec($value)+hexdec($offset)+2,$bytesofdata);
}
$formated_data = formatNikonData($type,$tag,$intel,$model,$data);
if($result['VerboseOutput']==1) {
$result['SubIFD']['MakerNote'][$tag_name] = $formated_data;
if($type=="URATIONAL" || $type=="SRATIONAL" || $type=="USHORT" || $type=="SSHORT" || $type=="ULONG" || $type=="SLONG" || $type=="FLOAT" || $type=="DOUBLE") {
$data = bin2hex($data);
if($intel==1) $data = intel2Moto($data);
}
$result['SubIFD']['MakerNote'][$tag_name."_Verbose"]['RawData'] = $data;
$result['SubIFD']['MakerNote'][$tag_name."_Verbose"]['Type'] = $type;
$result['SubIFD']['MakerNote'][$tag_name."_Verbose"]['Bytes'] = $bytesofdata;
} else {
$result['SubIFD']['MakerNote'][$tag_name] = $formated_data;
}
}
}
}
?>

189
-child/exifer/makers/olympus.php Executable file
View File

@@ -0,0 +1,189 @@
<?php //================================================================================================
//================================================================================================
//================================================================================================
/*
Exifer
Extracts EXIF information from digital photos.
Copyright <20> 2003 Jake Olefsky
http://www.offsky.com/software/exif/index.php
jake@olefsky.com
Please see exif.php for the complete information about this software.
------------
This program is free software; you can redistribute it and/or modify it under the terms of
the GNU General Public License as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. http://www.gnu.org/copyleft/gpl.html
*/
//================================================================================================
//================================================================================================
//================================================================================================
//=================
// Looks up the name of the tag for the MakerNote (Depends on Manufacturer)
//====================================================================
function lookup_Olympus_tag($tag) {
switch($tag) {
case "0200": $tag = "SpecialMode";break;
case "0201": $tag = "JpegQual";break;
case "0202": $tag = "Macro";break;
case "0203": $tag = "Unknown1";break;
case "0204": $tag = "DigiZoom";break;
case "0205": $tag = "Unknown2";break;
case "0206": $tag = "Unknown3";break;
case "0207": $tag = "SoftwareRelease";break;
case "0208": $tag = "PictInfo";break;
case "0209": $tag = "CameraID";break;
case "0f00": $tag = "DataDump";break;
default: $tag = "unknown:".$tag;break;
}
return $tag;
}
//=================
// Formats Data for the data type
//====================================================================
function formatOlympusData($type,$tag,$intel,$data) {
if($type=="ASCII") {
} else if($type=="URATIONAL" || $type=="SRATIONAL") {
$data = unRational($data,$type,$intel);
if($intel==1) $data = intel2Moto($data);
if($tag=="0204") { //DigitalZoom
$data=$data."x";
}
if($tag=="0205") { //Unknown2
}
} else if($type=="USHORT" || $type=="SSHORT" || $type=="ULONG" || $type=="SLONG" || $type=="FLOAT" || $type=="DOUBLE") {
$data = rational($data,$type,$intel);
if($tag=="0201") { //JPEGQuality
if($data == 1) $data = "SQ";
else if($data == 2) $data = "HQ";
else if($data == 3) $data = "SHQ";
else $data = gettext("Unknown").": ".$data;
}
if($tag=="0202") { //Macro
if($data == 0) $data = "Normal";
else if($data == 1) $data = "Macro";
else $data = gettext("Unknown").": ".$data;
}
} else if($type=="UNDEFINED") {
} else {
$data = bin2hex($data);
if($intel==1) $data = intel2Moto($data);
}
return $data;
}
//==============================================================================
// Olympus Special data section
// - Updated by Zenphoto for new header tag in E-410/E-510/E-3 cameras. 2/24/2008
//==============================================================================
function parseOlympus($block, &$result, $seek, $globalOffset) {
if($result['Endien']=="Intel") $intel = 1;
else $intel = 0;
$model = $result['IFD0']['Model'];
// New header for new DSLRs - Check for it because the
// number of bytes that count the IFD fields differ in each case.
// Fixed by Zenphoto 2/24/08
$new = false;
if (substr($block, 0, 8) == "OLYMPUS\x00") {
$new = true;
} else if (substr($block, 0, 7) == "OLYMP\x00\x01"
|| substr($block, 0, 7) == "OLYMP\x00\x02") {
$new = false;
} else {
// Header does not match known Olympus headers.
// This is not a valid OLYMPUS Makernote.
return false;
}
// Offset of IFD entry after Olympus header.
$place = 8;
$offset = 8;
// Get number of tags (1 or 2 bytes, depending on New or Old makernote)
$countfieldbits = $new ? 1 : 2;
// New makernote repeats 1-byte value twice, so increment $place by 2 in either case.
$num = bin2hex(substr($block, $place, $countfieldbits)); $place += 2;
if ($intel == 1) $num = intel2Moto($num);
$ntags = hexdec($num);
$result['SubIFD']['MakerNote']['MakerNoteNumTags'] = $ntags;
//loop thru all tags Each field is 12 bytes
for($i=0; $i < $ntags; $i++) {
//2 byte tag
$tag = bin2hex(substr($block, $place,2));
$place += 2;
if ($intel == 1) $tag = intel2Moto($tag);
$tag_name = lookup_Olympus_tag($tag);
//2 byte type
$type = bin2hex(substr($block, $place,2));
$place += 2;
if ($intel == 1) $type = intel2Moto($type);
lookup_type($type,$size);
//4 byte count of number of data units
$count = bin2hex(substr($block, $place,4));
$place+=4;
if ($intel == 1) $count = intel2Moto($count);
$bytesofdata = $size * hexdec($count);
//4 byte value of data or pointer to data
$value = substr($block, $place,4);
$place += 4;
if ($bytesofdata <= 4) {
$data = substr($value,0,$bytesofdata);
} else {
$value = bin2hex($value);
if($intel==1) $value = intel2Moto($value);
$v = fseek($seek,$globalOffset+hexdec($value)); //offsets are from TIFF header which is 12 bytes from the start of the file
if(isset($GLOBALS['exiferFileSize']) && $v == 0 && $bytesofdata < $GLOBALS['exiferFileSize']) {
$data = fread($seek, $bytesofdata);
} else {
$result['Errors'] = $result['Errors']++;
$data = '';
}
}
$formated_data = formatOlympusData($type,$tag,$intel,$data);
if($result['VerboseOutput']==1) {
$result['SubIFD']['MakerNote'][$tag_name] = $formated_data;
if($type=="URATIONAL" || $type=="SRATIONAL" || $type=="USHORT" || $type=="SSHORT" || $type=="ULONG" || $type=="SLONG" || $type=="FLOAT" || $type=="DOUBLE") {
$data = bin2hex($data);
if($intel==1) $data = intel2Moto($data);
}
$result['SubIFD']['MakerNote'][$tag_name."_Verbose"]['RawData'] = $data;
$result['SubIFD']['MakerNote'][$tag_name."_Verbose"]['Type'] = $type;
$result['SubIFD']['MakerNote'][$tag_name."_Verbose"]['Bytes'] = $bytesofdata;
} else {
$result['SubIFD']['MakerNote'][$tag_name] = $formated_data;
}
}
}
?>

View File

@@ -0,0 +1,292 @@
<?php
//================================================================================================
//================================================================================================
//================================================================================================
/*
Exifer
Extracts EXIF information from digital photos.
Copyright <20> 2003 Jake Olefsky
http://www.offsky.com/software/exif/index.php
jake@olefsky.com
Please see exif.php for the complete information about this software.
------------
This program is free software; you can redistribute it and/or modify it under the terms of
the GNU General Public License as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. http://www.gnu.org/copyleft/gpl.html
*/
//================================================================================================
//================================================================================================
//================================================================================================
//=================
// Looks up the name of the tag for the MakerNote (Depends on Manufacturer)
//====================================================================
function lookup_Panasonic_tag($tag) {
switch($tag) {
case "0001": $tag = "Quality";break;
case "0002": $tag = "FirmwareVersion";break;
case "0003": $tag = "WhiteBalance";break;
case "0007": $tag = "FocusMode";break;
case "000f": $tag = "AFMode";break;
case "001a": $tag = "ImageStabilizer";break;
case "001c": $tag = "MacroMode";break;
case "001f": $tag = "ShootingMode";break;
case "0020": $tag = "Audio";break;
case "0021": $tag = "DataDump";break;
case "0023": $tag = "WhiteBalanceBias";break;
case "0024": $tag = "FlashBias";break;
case "0025": $tag = "SerialNumber";break;
case "0028": $tag = "ColourEffect";break;
case "002a": $tag = "BurstMode";break;
case "002b": $tag = "SequenceNumber";break;
case "002c": $tag = "Contrast";break;
case "002d": $tag = "NoiseReduction";break;
case "002e": $tag = "SelfTimer";break;
case "0030": $tag = "Rotation";break;
case "0032": $tag = "ColorMode";break;
case "0036": $tag = "TravelDay";break;
default: $tag = "unknown:".$tag;break;
}
return $tag;
}
//=================
// Formats Data for the data type
//====================================================================
function formatPanasonicData($type,$tag,$intel,$data) {
if($type=="ASCII") {
} else if($type=="UBYTE" || $type=="SBYTE") {
$data = bin2hex($data);
if($intel==1) $data = intel2Moto($data);
$data=hexdec($data);
if($tag=="000f") { //AFMode
if($data == 256) $data = "9-area-focusing";
else if($data == 16) $data = "1-area-focusing";
else if($data == 4096) $data = gettext("3-area-focusing (High speed)");
else if($data == 4112) $data = gettext("1-area-focusing (High speed)");
else if($data == 16) $data = gettext("1-area-focusing");
else if($data == 1) $data = gettext("Spot-focusing");
else $data = "Unknown (".$data.")";
}
} else if($type=="URATIONAL" || $type=="SRATIONAL") {
$data = unRational($data,$type,$intel);
} else if($type=="USHORT" || $type=="SSHORT" || $type=="ULONG" || $type=="SLONG" || $type=="FLOAT" || $type=="DOUBLE") {
$data = rational($data,$type,$intel);
if($tag=="0001") { //Image Quality
if($data == 2) $data = gettext("High");
else if($data == 3) $data = gettext("Standard");
else if($data == 6) $data = gettext("Very High");
else if($data == 7) $data = gettext("RAW");
else $data = gettext("Unknown")." (".$data.")";
}
if($tag=="0003") { //White Balance
if($data == 1) $data = gettext("Auto");
else if($data == 2) $data = gettext("Daylight");
else if($data == 3) $data = gettext("Cloudy");
else if($data == 4) $data = gettext("Halogen");
else if($data == 5) $data = gettext("Manual");
else if($data == 8) $data = gettext("Flash");
else if($data == 10) $data = gettext("Black and White");
else if($data == 11) $data = gettext("Manual");
else $data = gettext("Unknown")." (".$data.")";
}
if($tag=="0007") { //Focus Mode
if($data == 1) $data = gettext("Auto");
else if($data == 2) $data = gettext("Manual");
else if($data == 4) $data = gettext("Auto, Focus button");
else if($data == 5) $data = gettext("Auto, Continuous");
else $data = gettext("Unknown")." (".$data.")";
}
if($tag=="001a") { //Image Stabilizer
if($data == 2) $data = gettext("Mode 1");
else if($data == 3) $data = gettext("Off");
else if($data == 4) $data = gettext("Mode 2");
else $data = gettext("Unknown")." (".$data.")";
}
if($tag=="001c") { //Macro mode
if($data == 1) $data = gettext("On");
else if($data == 2) $data = gettext("Off");
else $data = gettext("Unknown")." (".$data.")";
}
if($tag=="001f") { //Shooting Mode
if($data == 1) $data = gettext("Normal");
else if($data == 2) $data = gettext("Portrait");
else if($data == 3) $data = gettext("Scenery");
else if($data == 4) $data = gettext("Sports");
else if($data == 5) $data = gettext("Night Portrait");
else if($data == 6) $data = gettext("Program");
else if($data == 7) $data = gettext("Aperture Priority");
else if($data == 8) $data = gettext("Shutter Priority");
else if($data == 9) $data = gettext("Macro");
else if($data == 11) $data = gettext("Manual");
else if($data == 13) $data = gettext("Panning");
else if($data == 14) $data = gettext("Simple");
else if($data == 18) $data = gettext("Fireworks");
else if($data == 19) $data = gettext("Party");
else if($data == 20) $data = gettext("Snow");
else if($data == 21) $data = gettext("Night Scenery");
else if($data == 22) $data = gettext("Food");
else if($data == 23) $data = gettext("Baby");
else if($data == 27) $data = gettext("High Sensitivity");
else if($data == 29) $data = gettext("Underwater");
else if($data == 33) $data = gettext("Pet");
else $data = gettext("Unknown")." (".$data.")";
}
if($tag=="0020") { //Audio
if($data == 1) $data = gettext("Yes");
else if($data == 2) $data = gettext("No");
else $data = gettext("Unknown")." (".$data.")";
}
if($tag=="0023") { //White Balance Bias
$data=$data." EV";
}
if($tag=="0024") { //Flash Bias
$data = $data;
}
if($tag=="0028") { //Colour Effect
if($data == 1) $data = gettext("Off");
else if($data == 2) $data = gettext("Warm");
else if($data == 3) $data = gettext("Cool");
else if($data == 4) $data = gettext("Black and White");
else if($data == 5) $data = gettext("Sepia");
else $data = gettext("Unknown")." (".$data.")";
}
if($tag=="002a") { //Burst Mode
if($data == 0) $data = gettext("Off");
else if($data == 1) $data = gettext("Low/High Quality");
else if($data == 2) $data = gettext("Infinite");
else $data = gettext("Unknown")." (".$data.")";
}
if($tag=="002c") { //Contrast
if($data == 0) $data = gettext("Standard");
else if($data == 1) $data = gettext("Low");
else if($data == 2) $data = gettext("High");
else $data = gettext("Unknown")." (".$data.")";
}
if($tag=="002d") { //Noise Reduction
if($data == 0) $data = gettext("Standard");
else if($data == 1) $data = gettext("Low");
else if($data == 2) $data = gettext("High");
else $data = gettext("Unknown")." (".$data.")";
}
if($tag=="002e") { //Self Timer
if($data == 1) $data = gettext("Off");
else if($data == 2) $data = gettext("10s");
else if($data == 3) $data = gettext("2s");
else $data = gettext("Unknown")." (".$data.")";
}
if($tag=="0030") { //Rotation
if($data == 1) $data = gettext("Horizontal (normal)");
else if($data == 6) $data = gettext("Rotate 90 CW");
else if($data == 8) $data = gettext("Rotate 270 CW");
else $data = gettext("Unknown")." (".$data.")";
}
if($tag=="0032") { //Color Mode
if($data == 0) $data = gettext("Normal");
else if($data == 1) $data = gettext("Natural");
else $data = gettext("Unknown")." (".$data.")";
}
if($tag=="0036") { //Travel Day
$data=$data;
}
} else if($type=="UNDEFINED") {
} else {
$data = bin2hex($data);
if($intel==1) $data = intel2Moto($data);
}
return $data;
}
//=================
// Panasonic Special data section
//====================================================================
function parsePanasonic($block,&$result) {
//if($result['Endien']=="Intel") $intel=1;
//else $intel=0;
$intel=1;
$model = $result['IFD0']['Model'];
$place=8; //current place
$offset=8;
$num = bin2hex(substr($block,$place,4));$place+=4;
if($intel==1) $num = intel2Moto($num);
$result['SubIFD']['MakerNote']['Offset'] = hexdec($num);
//Get number of tags (2 bytes)
$num = bin2hex(substr($block,$place,2));$place+=2;
if($intel==1) $num = intel2Moto($num);
$result['SubIFD']['MakerNote']['MakerNoteNumTags'] = hexdec($num);
//loop thru all tags Each field is 12 bytes
for($i=0;$i<hexdec($num);$i++) {
//2 byte tag
$tag = bin2hex(substr($block,$place,2));$place+=2;
if($intel==1) $tag = intel2Moto($tag);
$tag_name = lookup_Panasonic_tag($tag);
//2 byte type
$type = bin2hex(substr($block,$place,2));$place+=2;
if($intel==1) $type = intel2Moto($type);
lookup_type($type,$size);
//4 byte count of number of data units
$count = bin2hex(substr($block,$place,4));$place+=4;
if($intel==1) $count = intel2Moto($count);
$bytesofdata = validSize($size*hexdec($count));
//4 byte value of data or pointer to data
$value = substr($block,$place,4);$place+=4;
if($bytesofdata<=4) {
$data = substr($value,0,$bytesofdata);
} else {
$value = bin2hex($value);
if($intel==1) $value = intel2Moto($value);
$data = substr($block,hexdec($value)-$offset,$bytesofdata*2);
}
$formated_data = formatPanasonicData($type,$tag,$intel,$data);
if($result['VerboseOutput']==1) {
$result['SubIFD']['MakerNote'][$tag_name] = $formated_data;
if($type=="URATIONAL" || $type=="SRATIONAL" || $type=="USHORT" || $type=="SSHORT" || $type=="ULONG" || $type=="SLONG" || $type=="FLOAT" || $type=="DOUBLE") {
$data = bin2hex($data);
if($intel==1) $data = intel2Moto($data);
}
$result['SubIFD']['MakerNote'][$tag_name."_Verbose"]['RawData'] = $data;
$result['SubIFD']['MakerNote'][$tag_name."_Verbose"]['Type'] = $type;
$result['SubIFD']['MakerNote'][$tag_name."_Verbose"]['Bytes'] = $bytesofdata;
} else {
$result['SubIFD']['MakerNote'][$tag_name] = $formated_data;
}
}
}
?>

157
-child/exifer/makers/sanyo.php Executable file
View File

@@ -0,0 +1,157 @@
<?php //================================================================================================
//================================================================================================
//================================================================================================
/*
Exifer
Extracts EXIF information from digital photos.
Copyright <20> 2003 Jake Olefsky
http://www.offsky.com/software/exif/index.php
jake@olefsky.com
Please see exif.php for the complete information about this software.
------------
This program is free software; you can redistribute it and/or modify it under the terms of
the GNU General Public License as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. http://www.gnu.org/copyleft/gpl.html
*/
//================================================================================================
//================================================================================================
//================================================================================================
//=================
// Looks up the name of the tag for the MakerNote (Depends on Manufacturer)
//====================================================================
function lookup_Sanyo_tag($tag) {
switch($tag) {
case "0200": $tag = "SpecialMode";break;
case "0201": $tag = "Quality";break;
case "0202": $tag = "Macro";break;
case "0203": $tag = "Unknown";break;
case "0204": $tag = "DigiZoom";break;
case "0f00": $tag = "DataDump";break;
default: $tag = "unknown:".$tag;break;
}
return $tag;
}
//=================
// Formats Data for the data type
//====================================================================
function formatSanyoData($type,$tag,$intel,$data) {
if($type=="ASCII") {
} else if($type=="URATIONAL" || $type=="SRATIONAL") {
$data = unRational($data,$type,$intel);
} else if($type=="USHORT" || $type=="SSHORT" || $type=="ULONG" || $type=="SLONG" || $type=="FLOAT" || $type=="DOUBLE") {
$data = rational($data,$type,$intel);
if($tag=="0200") { //SpecialMode
if($data == 0) $data = gettext("Normal");
else $data = gettext("Unknown").": ".$data;
}
if($tag=="0201") { //Quality
if($data == 2) $data = gettext("High");
else $data = gettext("Unknown").": ".$data;
}
if($tag=="0202") { //Macro
if($data == 0) $data = gettext("Normal");
else $data = gettext("Unknown").": ".$data;
}
} else if($type=="UNDEFINED") {
} else {
$data = bin2hex($data);
if($intel==1) $data = intel2Moto($data);
}
return $data;
}
//=================
// Sanyo Special data section
//====================================================================
function parseSanyo($block,&$result,$seek, $globalOffset) {
if($result['Endien']=="Intel") $intel=1;
else $intel=0;
$model = $result['IFD0']['Model'];
$place=8; //current place
$offset=8;
//Get number of tags (2 bytes)
$num = bin2hex(substr($block,$place,2));$place+=2;
if($intel==1) $num = intel2Moto($num);
$result['SubIFD']['MakerNote']['MakerNoteNumTags'] = hexdec($num);
//loop thru all tags Each field is 12 bytes
for($i=0;$i<hexdec($num);$i++) {
//2 byte tag
$tag = bin2hex(substr($block,$place,2));$place+=2;
if($intel==1) $tag = intel2Moto($tag);
$tag_name = lookup_Sanyo_tag($tag);
//2 byte type
$type = bin2hex(substr($block,$place,2));$place+=2;
if($intel==1) $type = intel2Moto($type);
lookup_type($type,$size);
//4 byte count of number of data units
$count = bin2hex(substr($block,$place,4));$place+=4;
if($intel==1) $count = intel2Moto($count);
$bytesofdata = validSize($size*hexdec($count));
//4 byte value of data or pointer to data
$value = substr($block,$place,4);$place+=4;
if($bytesofdata<=4) {
$data = substr($value,0,$bytesofdata);
} else {
$value = bin2hex($value);
if($intel==1) $value = intel2Moto($value);
$v = fseek($seek,$globalOffset+hexdec($value)); //offsets are from TIFF header which is 12 bytes from the start of the file
if($tag!=0) {
$data = fread($seek, $bytesofdata);
} else if($v==-1) {
$result['Errors'] = $result['Errors']++;
}
}
$formated_data = formatSanyoData($type,$tag,$intel,$data);
if($result['VerboseOutput']==1) {
$result['SubIFD']['MakerNote'][$tag_name] = $formated_data;
if($type=="URATIONAL" || $type=="SRATIONAL" || $type=="USHORT" || $type=="SSHORT" || $type=="ULONG" || $type=="SLONG" || $type=="FLOAT" || $type=="DOUBLE") {
$data = bin2hex($data);
if($intel==1) $data = intel2Moto($data);
}
$result['SubIFD']['MakerNote'][$tag_name."_Verbose"]['RawData'] = $data;
$result['SubIFD']['MakerNote'][$tag_name."_Verbose"]['Type'] = $type;
$result['SubIFD']['MakerNote'][$tag_name."_Verbose"]['Bytes'] = $bytesofdata;
} else {
$result['SubIFD']['MakerNote'][$tag_name] = $formated_data;
}
}
}
?>