- Timestamp:
- Feb 28, 2010, 6:15:11 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/AMetaData/JpegMetaData/TagDefinitions/XmpTags.class.php
r4972 r4998 48 48 class XmpTags extends KnownTags 49 49 { 50 /** 51 * this function extract from an Xmp Alt structure, the value in the given 52 * lang 53 * 54 * @param Array $tagValues : 55 * @param String $lang : the needed lang 56 * @return String : the value in the specified lang, or in the default lang 57 * if there is no specific value for the specified lang 58 */ 59 static public function getAltValue($tagValues, $lang="x-default") 60 { 61 /* 62 * test if the $tagValues is valid, otherwise return the $tagValues as 63 * result 64 */ 65 if(!is_array($tagValues)) return($tagValues); 66 if(!array_key_exists("type", $tagValues) or 67 !array_key_exists("values", $tagValues) ) 68 return($tagValues); 69 if($tagValues['type']!="alt") return($tagValues); 70 71 $returned=""; 72 foreach($tagValues['values'] as $key => $val) 73 { 74 if($val['type']['value']==$lang or 75 XmpTags::lang($val['type']['value'])==$lang or 76 $val['type']['value']=="x-default") 77 $returned=$val['value']; 78 } 79 return($returned); 80 } 81 82 /** 83 * this function tries to format the lang Id 84 * something like "fr-fr" is returned as "fr_FR" 85 */ 86 static private function lang($lang) 87 { 88 $result=preg_match("/([a-z]*)([-|_])([a-z]*)/i", $lang, $arr); 89 return($arr[1]."_".strtoupper($arr[3])); 90 } 91 50 92 const TYPE_SIMPLE = 0x00; 51 93 const TYPE_SEQ = 0x01; … … 1308 1350 /* 1309 1351 * The Flash is a sequence of Flash structure 1310 * Not yet implemented 1352 * Don't use the exif:Flash, but the associated tags : 1353 * exif:Fired, exif:Return, exif:Mode, exif:Function, exif:RedEyeMode 1311 1354 */ 1312 1355 'exif:Flash' => Array( … … 1317 1360 'schema' => "exif", 1318 1361 ), 1362 1363 'exif:Fired' => Array( 1364 'implemented' => true, 1365 'translatable' => true, 1366 'type' => self::TYPE_SIMPLE, 1367 'schema' => "exif", 1368 'tagValues' => Array( 1369 'False' => "flash did not fire", 1370 'True' => "flash fired" 1371 ), 1372 ), 1373 1374 'exif:Return' => Array( 1375 'implemented' => true, 1376 'translatable' => true, 1377 'type' => self::TYPE_SIMPLE, 1378 'schema' => "exif", 1379 'tagValues' => Array( 1380 0x00 => "no strobe", 1381 0x01 => "reserved", 1382 0x02 => "strobe return light not detected", 1383 0x03 => "strobe return light detected" 1384 ), 1385 ), 1386 1387 'exif:Mode' => Array( 1388 'implemented' => true, 1389 'translatable' => true, 1390 'type' => self::TYPE_SIMPLE, 1391 'schema' => "exif", 1392 'tagValues' => Array( 1393 0x00 => "unknown", 1394 0x01 => "compulsory flash firing", 1395 0x02 => "compulsory flash suppression", 1396 0x03 => "auto mode" 1397 ), 1398 ), 1399 1400 'exif:Function' => Array( 1401 'implemented' => true, 1402 'translatable' => true, 1403 'type' => self::TYPE_SIMPLE, 1404 'schema' => "exif", 1405 'tagValues' => Array( 1406 'False' => "flash function present", 1407 'True' => "no flash function" 1408 ), 1409 ), 1410 1411 'exif:RedEyeMode' => Array( 1412 'implemented' => true, 1413 'translatable' => true, 1414 'type' => self::TYPE_SIMPLE, 1415 'schema' => "exif", 1416 'tagValues' => Array( 1417 'False' => "no red-eye reduction mode or unknown", 1418 'True' => "red-eye reduction supported" 1419 ), 1420 ), 1421 1319 1422 'exif:FocalLength' => Array( 1320 1423 'exifTag' => 0x920A,
Note: See TracChangeset
for help on using the changeset viewer.