本文整理汇总了PHP中lookup_type函数的典型用法代码示例。如果您正苦于以下问题:PHP lookup_type函数的具体用法?PHP lookup_type怎么用?PHP lookup_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了lookup_type函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseOlympus
function parseOlympus($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_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 = $value;
} 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 {
if ($v == -1) {
$result['Errors'] = $result['Errors']++;
}
}
}
$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;
}
}
}
示例2: read_entry
function read_entry(&$result, $in, $seek, $intel, $ifd_name, $globalOffset)
{
if (feof($in)) {
// test to make sure we can still read.
$result['Errors'] = $result['Errors'] + 1;
return;
}
// 2 byte tag
$tag = bin2hex(fread($in, 2));
if ($intel == 1) {
$tag = intel2Moto($tag);
}
$tag_name = lookup_tag($tag);
// 2 byte datatype
$type = bin2hex(fread($in, 2));
if ($intel == 1) {
$type = intel2Moto($type);
}
lookup_type($type, $size);
if (strpos($tag_name, 'unknown:') !== false && strpos($type, 'error:') !== false) {
// we have an error
$result['Errors'] = $result['Errors'] + 1;
return;
}
// 4 byte number of elements
$count = bin2hex(fread($in, 4));
if ($intel == 1) {
$count = intel2Moto($count);
}
$bytesofdata = $size * hexdec($count);
// 4 byte value or pointer to value if larger than 4 bytes
$value = fread($in, 4);
if ($bytesofdata <= 4) {
// if datatype is 4 bytes or less, its the value
$data = $value;
} else {
if ($bytesofdata < 100000) {
// otherwise its a pointer to the value, so lets go get it
$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 {
if ($v == -1) {
$result['Errors'] = $result['Errors'] + 1;
}
}
} else {
// bytesofdata was too big, so the exif had an error
$result['Errors'] = $result['Errors'] + 1;
return;
}
}
if ($tag_name == 'MakerNote') {
// if its a maker tag, we need to parse this specially
$make = $result['IFD0']['Make'];
if ($result['VerboseOutput'] == 1) {
$result[$ifd_name]['MakerNote']['RawData'] = $data;
}
if (preg_match('/NIKON/i', $make)) {
require_once dirname(__FILE__) . '/makers/nikon.php';
parseNikon($data, $result);
$result[$ifd_name]['KnownMaker'] = 1;
} else {
if (preg_match('/OLYMPUS/i', $make)) {
require_once dirname(__FILE__) . '/makers/olympus.php';
parseOlympus($data, $result, $seek, $globalOffset);
$result[$ifd_name]['KnownMaker'] = 1;
} else {
if (preg_match('/Canon/i', $make)) {
require_once dirname(__FILE__) . '/makers/canon.php';
parseCanon($data, $result, $seek, $globalOffset);
$result[$ifd_name]['KnownMaker'] = 1;
} else {
if (preg_match('/FUJIFILM/i', $make)) {
require_once dirname(__FILE__) . '/makers/fujifilm.php';
parseFujifilm($data, $result);
$result[$ifd_name]['KnownMaker'] = 1;
} else {
if (preg_match('/SANYO/i', $make)) {
require_once dirname(__FILE__) . '/makers/sanyo.php';
parseSanyo($data, $result, $seek, $globalOffset);
$result[$ifd_name]['KnownMaker'] = 1;
} else {
if (preg_match('/Panasonic/i', $make)) {
require_once dirname(__FILE__) . '/makers/panasonic.php';
parsePanasonic($data, $result, $seek, $globalOffset);
$result[$ifd_name]['KnownMaker'] = 1;
} else {
$result[$ifd_name]['KnownMaker'] = 0;
}
}
}
}
}
}
//.........这里部分代码省略.........
示例3: parseFujifilm
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 = $size * hexdec($count);
//4 byte value of data or pointer to data
$value = substr($block, $place, 4);
$place += 4;
if ($bytesofdata <= 4) {
$data = $value;
} 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;
}
}
}
示例4: parseGPS
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 = $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 = $value;
} 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);
}
}
}
示例5: parseCanon
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 = $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 = $value;
} 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;
}
}
}
示例6: parseNikon
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" || $model == "E800" || $model == "E900" || $model == "E900S" || $model == "E910" || $model == "E950") {
$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 = $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 = $value;
} 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));
//.........这里部分代码省略.........
示例7: parseOlympus
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") {
$new = true;
} else {
if (substr($block, 0, 7) == "OLYMP" || substr($block, 0, 7) == "OLYMP") {
$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 = $value;
} 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;
}
}
}
示例8: read_entry
function read_entry(&$result, $in, $seek, $intel, $ifd_name, $globalOffset)
{
if (feof($in)) {
//test to make sure we can still read.
$result['Errors'] = $result['Errors'] + 1;
return;
}
//2 byte tag
$tag = bin2hex(fread($in, 2));
if ($intel == 1) {
$tag = intel2Moto($tag);
}
$tag_name = lookup_tag($tag);
//2 byte datatype
$type = bin2hex(fread($in, 2));
if ($intel == 1) {
$type = intel2Moto($type);
}
lookup_type($type, $size);
//4 byte number of elements
$count = bin2hex(fread($in, 4));
if ($intel == 1) {
$count = intel2Moto($count);
}
$bytesofdata = $size * hexdec($count);
//4 byte value or pointer to value if larger than 4 bytes
$value = fread($in, 4);
if ($bytesofdata <= 4) {
//if datatype is 4 bytes or less, its the value
$data = $value;
} else {
if ($bytesofdata < 100000) {
//otherwise its a pointer to the value, so lets go get it
$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 {
if ($v == -1) {
$result['Errors'] = $result['Errors'] + 1;
}
}
} else {
//bytesofdata was too big, so the exif had an error
$result['Errors'] = $result['Errors'] + 1;
return;
}
}
if ($tag_name == "MakerNote") {
//if its a maker tag, we need to parse this specially
$make = $result['IFD0']['Make'];
if ($result['VerboseOutput'] == 1) {
$result[$ifd_name]['MakerNote']['RawData'] = $data;
}
if (eregi("NIKON", $make)) {
require_once 'makers/nikon.php';
parseNikon($data, $result);
$result[$ifd_name]['KnownMaker'] = 1;
} else {
if (eregi("OLYMPUS", $make)) {
require_once 'makers/olympus.php';
parseOlympus($data, $result, $seek, $globalOffset);
$result[$ifd_name]['KnownMaker'] = 1;
} else {
if (eregi("Canon", $make)) {
require_once 'makers/canon.php';
parseCanon($data, $result, $seek, $globalOffset);
$result[$ifd_name]['KnownMaker'] = 1;
} else {
if (eregi("FUJIFILM", $make)) {
require_once 'makers/fujifilm.php';
parseFujifilm($data, $result);
$result[$ifd_name]['KnownMaker'] = 1;
} else {
if (eregi("SANYO", $make)) {
require_once 'makers/sanyo.php';
parseSanyo($data, $result, $seek, $globalOffset);
$result[$ifd_name]['KnownMaker'] = 1;
} else {
$result[$ifd_name]['KnownMaker'] = 0;
}
}
}
}
}
} else {
if ($tag_name == "GPSInfoOffset") {
require_once 'makers/gps.php';
$formated_data = formatData($type, $tag, $intel, $data);
$result[$ifd_name]['GPSInfo'] = $formated_data;
parseGPS($data, $result, $formated_data, $seek, $globalOffset);
} else {
//Format the data depending on the type and tag
$formated_data = formatData($type, $tag, $intel, $data);
$result[$ifd_name][$tag_name] = $formated_data;
if ($result['VerboseOutput'] == 1) {
//.........这里部分代码省略.........
示例9: parseCanon
function parseCanon($block, &$result, $seek, $globalOffset)
{
global $exiferFileSize;
//Manuel: this makes canon maker notes work
$place = 0;
//current place
if ($result['Endien'] == "Intel") {
$intel = 1;
} else {
$intel = 0;
}
/* Manuel: start determine a possible makernote offset given in the makernote trailer */
$offsetDelta = 0;
//currentOffset of MakerNote starting after TIFF header
$blockLenBytes = strlen(bin2hex($block)) / 2;
$currentOffset = ftell($seek) - $blockLenBytes - $globalOffset;
//get potential trailer 8bytes from end of MakerNote
//first 4 bytes are trailer signature corresponding to TIFF header
$trailerId = bin2hex(substr($block, -8, 4));
if ($intel) {
$tiffHeader = bin2hex('II');
//Intel
// 2 bytes of 0x002a
$tiffHeader .= intel2Moto('002a');
} else {
$tiffHeader = bin2hex('MM');
//Motorola
$tiffHeader .= '002a';
}
if ($trailerId == $tiffHeader) {
//is it the trailer?
//next 4 bytes contain offset value
$mnOffset = bin2hex(substr($block, -4));
if ($intel == 1) {
$mnOffset = intel2Moto($mnOffset);
}
//calculate the delta
$offsetDelta = $currentOffset - hexdec($mnOffset);
}
/* Manuel: end determine makernote offset */
$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 = $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 = $value;
} else {
$value = bin2hex($value);
if ($intel == 1) {
$value = intel2Moto($value);
}
//offsets are from TIFF header which is 12 bytes from the start of the file
//Manuel: also account for $offsetDelta given by the makernote offset in TIFF trailer
$v = fseek($seek, $globalOffset + hexdec($value) + $offsetDelta);
if ($v == 0 && $bytesofdata < $exiferFileSize) {
//Manuel: this makes canon maker notes work
$data = fread($seek, $bytesofdata);
} else {
if ($v == -1) {
$result['Errors'] = $result['Errors']++;
}
}
}
$formated_data = formatCanonData($type, $tag, $intel, $data, $result, $result['SubIFD']['MakerNote'][$tag_name]);
if ($result['VerboseOutput'] == 1) {
//$result['SubIFD']['MakerNote'][$tag_name] = $formated_data;
//.........这里部分代码省略.........