MediaWiki  REL1_22
XMPInfo.php
Go to the documentation of this file.
00001 <?php
00029 class XMPInfo {
00030 
00034     public static function getItems() {
00035         if ( !self::$ranHooks ) {
00036             // This is for if someone makes a custom metadata extension.
00037             // For example, a medical wiki might want to decode DICOM xmp properties.
00038             wfRunHooks( 'XMPGetInfo', Array( &self::$items ) );
00039             self::$ranHooks = true; // Only want to do this once.
00040         }
00041         return self::$items;
00042     }
00043 
00044     static private $ranHooks = false;
00045 
00066     static private $items = array(
00067         'http://ns.adobe.com/exif/1.0/' => array(
00068             'ApertureValue' => array(
00069                 'map_group' => 'exif',
00070                 'mode'      => XMPReader::MODE_SIMPLE,
00071                 'validate'  => 'validateRational'
00072             ),
00073             'BrightnessValue' => array(
00074                 'map_group' => 'exif',
00075                 'mode'      => XMPReader::MODE_SIMPLE,
00076                 'validate'  => 'validateRational'
00077             ),
00078             'CompressedBitsPerPixel' => array(
00079                 'map_group' => 'exif',
00080                 'mode'      => XMPReader::MODE_SIMPLE,
00081                 'validate'  => 'validateRational'
00082             ),
00083             'DigitalZoomRatio' => array(
00084                 'map_group' => 'exif',
00085                 'mode'      => XMPReader::MODE_SIMPLE,
00086                 'validate'  => 'validateRational'
00087             ),
00088             'ExposureBiasValue' => array(
00089                 'map_group' => 'exif',
00090                 'mode'      => XMPReader::MODE_SIMPLE,
00091                 'validate'  => 'validateRational'
00092             ),
00093             'ExposureIndex' => array(
00094                 'map_group' => 'exif',
00095                 'mode'      => XMPReader::MODE_SIMPLE,
00096                 'validate'  => 'validateRational'
00097             ),
00098             'ExposureTime' => array(
00099                 'map_group' => 'exif',
00100                 'mode'      => XMPReader::MODE_SIMPLE,
00101                 'validate'  => 'validateRational'
00102             ),
00103             'FlashEnergy' => array(
00104                 'map_group' => 'exif',
00105                 'mode'      => XMPReader::MODE_SIMPLE,
00106                 'validate'  => 'validateRational',
00107             ),
00108             'FNumber' => array(
00109                 'map_group' => 'exif',
00110                 'mode'      => XMPReader::MODE_SIMPLE,
00111                 'validate'  => 'validateRational'
00112             ),
00113             'FocalLength' => array(
00114                 'map_group' => 'exif',
00115                 'mode'      => XMPReader::MODE_SIMPLE,
00116                 'validate'  => 'validateRational'
00117             ),
00118             'FocalPlaneXResolution' => array(
00119                 'map_group' => 'exif',
00120                 'mode'      => XMPReader::MODE_SIMPLE,
00121                 'validate'  => 'validateRational'
00122             ),
00123             'FocalPlaneYResolution' => array(
00124                 'map_group' => 'exif',
00125                 'mode'      => XMPReader::MODE_SIMPLE,
00126                 'validate'  => 'validateRational'
00127             ),
00128             'GPSAltitude' => array(
00129                 'map_group' => 'exif',
00130                 'mode'      => XMPReader::MODE_SIMPLE,
00131                 'validate'  => 'validateRational',
00132             ),
00133             'GPSDestBearing' => array(
00134                 'map_group' => 'exif',
00135                 'mode'      => XMPReader::MODE_SIMPLE,
00136                 'validate'  => 'validateRational'
00137             ),
00138             'GPSDestDistance' => array(
00139                 'map_group' => 'exif',
00140                 'mode'      => XMPReader::MODE_SIMPLE,
00141                 'validate'  => 'validateRational'
00142             ),
00143             'GPSDOP' => array(
00144                 'map_group' => 'exif',
00145                 'mode'      => XMPReader::MODE_SIMPLE,
00146                 'validate'  => 'validateRational'
00147             ),
00148             'GPSImgDirection' => array(
00149                 'map_group' => 'exif',
00150                 'mode'      => XMPReader::MODE_SIMPLE,
00151                 'validate'  => 'validateRational'
00152             ),
00153             'GPSSpeed' => array(
00154                 'map_group' => 'exif',
00155                 'mode'      => XMPReader::MODE_SIMPLE,
00156                 'validate'  => 'validateRational'
00157             ),
00158             'GPSTrack' => array(
00159                 'map_group' => 'exif',
00160                 'mode'      => XMPReader::MODE_SIMPLE,
00161                 'validate'  => 'validateRational'
00162             ),
00163             'MaxApertureValue'  => array(
00164                 'map_group' => 'exif',
00165                 'mode'      => XMPReader::MODE_SIMPLE,
00166                 'validate'  => 'validateRational'
00167             ),
00168             'ShutterSpeedValue' => array(
00169                 'map_group' => 'exif',
00170                 'mode'      => XMPReader::MODE_SIMPLE,
00171                 'validate'  => 'validateRational'
00172             ),
00173             'SubjectDistance'   => array(
00174                 'map_group' => 'exif',
00175                 'mode'      => XMPReader::MODE_SIMPLE,
00176                 'validate'  => 'validateRational'
00177             ),
00178             /* Flash */
00179             'Flash'             => array(
00180                 'mode'      => XMPReader::MODE_STRUCT,
00181                 'children'  => array(
00182                     'Fired'      => true,
00183                     'Function'   => true,
00184                     'Mode'       => true,
00185                     'RedEyeMode' => true,
00186                     'Return'     => true,
00187                 ),
00188                 'validate'  => 'validateFlash',
00189                 'map_group' => 'exif',
00190             ),
00191             'Fired'             => array(
00192                 'map_group' => 'exif',
00193                 'validate'  => 'validateBoolean',
00194                 'mode'      => XMPReader::MODE_SIMPLE,
00195                 'structPart'=> true,
00196             ),
00197             'Function'          => array(
00198                 'map_group' => 'exif',
00199                 'validate'  => 'validateBoolean',
00200                 'mode'      => XMPReader::MODE_SIMPLE,
00201                 'structPart'=> true,
00202             ),
00203             'Mode'              => array(
00204                 'map_group' => 'exif',
00205                 'validate'  => 'validateClosed',
00206                 'mode'      => XMPReader::MODE_SIMPLE,
00207                 'choices'   => array( '0' => true, '1' => true,
00208                         '2' => true, '3' => true ),
00209                 'structPart'=> true,
00210             ),
00211             'Return'            => array(
00212                 'map_group' => 'exif',
00213                 'validate'  => 'validateClosed',
00214                 'mode'      => XMPReader::MODE_SIMPLE,
00215                 'choices'   => array( '0' => true,
00216                         '2' => true, '3' => true ),
00217                 'structPart'=> true,
00218             ),
00219             'RedEyeMode'        => array(
00220                 'map_group' => 'exif',
00221                 'validate'  => 'validateBoolean',
00222                 'mode'      => XMPReader::MODE_SIMPLE,
00223                 'structPart'=> true,
00224             ),
00225             /* End Flash */
00226             'ISOSpeedRatings'   => array(
00227                 'map_group' => 'exif',
00228                 'mode'      => XMPReader::MODE_SEQ,
00229                 'validate'  => 'validateInteger'
00230             ),
00231             /* end rational things */
00232             'ColorSpace'   => array(
00233                 'map_group' => 'exif',
00234                 'mode'      => XMPReader::MODE_SIMPLE,
00235                 'validate'  => 'validateClosed',
00236                 'choices'   => array( '1' => true, '65535' => true ),
00237             ),
00238             'ComponentsConfiguration'   => array(
00239                 'map_group' => 'exif',
00240                 'mode'      => XMPReader::MODE_SEQ,
00241                 'validate'  => 'validateClosed',
00242                 'choices'   => array( '1' => true, '2' => true, '3' => true, '4' => true,
00243                         '5' => true, '6' => true )
00244             ),
00245             'Contrast'          => array(
00246                 'map_group' => 'exif',
00247                 'mode'      => XMPReader::MODE_SIMPLE,
00248                 'validate'  => 'validateClosed',
00249                 'choices'   => array( '0' => true, '1' => true, '2' => true )
00250             ),
00251             'CustomRendered'    => array(
00252                 'map_group' => 'exif',
00253                 'mode'      => XMPReader::MODE_SIMPLE,
00254                 'validate'  => 'validateClosed',
00255                 'choices'   => array( '0' => true, '1' => true )
00256             ),
00257             'DateTimeOriginal'  => array(
00258                 'map_group' => 'exif',
00259                 'mode'      => XMPReader::MODE_SIMPLE,
00260                 'validate'  => 'validateDate',
00261             ),
00262             'DateTimeDigitized' => array( /* xmp:CreateDate */
00263                 'map_group' => 'exif',
00264                 'mode'      => XMPReader::MODE_SIMPLE,
00265                 'validate'  => 'validateDate',
00266             ),
00267             /* todo: there might be interesting information in
00268              * exif:DeviceSettingDescription, but need to find an
00269              * example
00270              */
00271             'ExifVersion'       => array(
00272                 'map_group' => 'exif',
00273                 'mode'      => XMPReader::MODE_SIMPLE,
00274             ),
00275             'ExposureMode'      => array(
00276                 'map_group' => 'exif',
00277                 'mode'      => XMPReader::MODE_SIMPLE,
00278                 'validate'  => 'validateClosed',
00279                 'rangeLow'  => 0,
00280                 'rangeHigh' => 2,
00281             ),
00282             'ExposureProgram'   => array(
00283                 'map_group' => 'exif',
00284                 'mode'      => XMPReader::MODE_SIMPLE,
00285                 'validate'  => 'validateClosed',
00286                 'rangeLow'  => 0,
00287                 'rangeHigh' => 8,
00288             ),
00289             'FileSource'        => array(
00290                 'map_group' => 'exif',
00291                 'mode'      => XMPReader::MODE_SIMPLE,
00292                 'validate'  => 'validateClosed',
00293                 'choices'   => array( '3' => true )
00294             ),
00295             'FlashpixVersion'   => array(
00296                 'map_group' => 'exif',
00297                 'mode'      => XMPReader::MODE_SIMPLE,
00298             ),
00299             'FocalLengthIn35mmFilm' => array(
00300                 'map_group' => 'exif',
00301                 'mode'      => XMPReader::MODE_SIMPLE,
00302                 'validate'  => 'validateInteger',
00303             ),
00304             'FocalPlaneResolutionUnit' => array(
00305                 'map_group' => 'exif',
00306                 'mode'      => XMPReader::MODE_SIMPLE,
00307                 'validate'  => 'validateClosed',
00308                 'choices'   => array( '2' => true, '3' => true ),
00309             ),
00310             'GainControl'       => array(
00311                 'map_group' => 'exif',
00312                 'mode'      => XMPReader::MODE_SIMPLE,
00313                 'validate'  => 'validateClosed',
00314                 'rangeLow'  => 0,
00315                 'rangeHigh' => 4,
00316             ),
00317             /* this value is post-processed out later */
00318             'GPSAltitudeRef'    => array(
00319                 'map_group' => 'exif',
00320                 'mode'      => XMPReader::MODE_SIMPLE,
00321                 'validate'  => 'validateClosed',
00322                 'choices'   => array( '0' => true, '1' => true ),
00323             ),
00324             'GPSAreaInformation' => array(
00325                 'map_group' => 'exif',
00326                 'mode'      => XMPReader::MODE_SIMPLE,
00327             ),
00328             'GPSDestBearingRef' => array(
00329                 'map_group' => 'exif',
00330                 'mode'      => XMPReader::MODE_SIMPLE,
00331                 'validate'  => 'validateClosed',
00332                 'choices'   => array( 'T' => true, 'M' => true ),
00333             ),
00334             'GPSDestDistanceRef' => array(
00335                 'map_group' => 'exif',
00336                 'mode'      => XMPReader::MODE_SIMPLE,
00337                 'validate'  => 'validateClosed',
00338                 'choices'   => array( 'K' => true, 'M' => true,
00339                         'N' => true ),
00340             ),
00341             'GPSDestLatitude'   => array(
00342                 'map_group' => 'exif',
00343                 'mode'      => XMPReader::MODE_SIMPLE,
00344                 'validate'  => 'validateGPS',
00345             ),
00346             'GPSDestLongitude'  => array(
00347                 'map_group' => 'exif',
00348                 'mode'      => XMPReader::MODE_SIMPLE,
00349                 'validate'  => 'validateGPS',
00350             ),
00351             'GPSDifferential'   => array(
00352                 'map_group' => 'exif',
00353                 'mode'      => XMPReader::MODE_SIMPLE,
00354                 'validate'  => 'validateClosed',
00355                 'choices'   => array( '0' => true, '1' => true ),
00356             ),
00357             'GPSImgDirectionRef' => array(
00358                 'map_group'  => 'exif',
00359                 'mode'       => XMPReader::MODE_SIMPLE,
00360                 'validate'   => 'validateClosed',
00361                 'choices'    => array( 'T' => true, 'M' => true ),
00362             ),
00363             'GPSLatitude'       => array(
00364                 'map_group' => 'exif',
00365                 'mode'      => XMPReader::MODE_SIMPLE,
00366                 'validate'  => 'validateGPS',
00367             ),
00368             'GPSLongitude'      => array(
00369                 'map_group' => 'exif',
00370                 'mode'      => XMPReader::MODE_SIMPLE,
00371                 'validate'  => 'validateGPS',
00372             ),
00373             'GPSMapDatum'       => array(
00374                 'map_group' => 'exif',
00375                 'mode'      => XMPReader::MODE_SIMPLE,
00376             ),
00377             'GPSMeasureMode'    => array(
00378                 'map_group' => 'exif',
00379                 'mode'      => XMPReader::MODE_SIMPLE,
00380                 'validate'  => 'validateClosed',
00381                 'choices'   => array( '2' => true, '3' => true )
00382             ),
00383             'GPSProcessingMethod' => array(
00384                 'map_group' => 'exif',
00385                 'mode'      => XMPReader::MODE_SIMPLE,
00386             ),
00387             'GPSSatellites'     => array(
00388                 'map_group' => 'exif',
00389                 'mode'      => XMPReader::MODE_SIMPLE,
00390             ),
00391             'GPSSpeedRef'       => array(
00392                 'map_group' => 'exif',
00393                 'mode'      => XMPReader::MODE_SIMPLE,
00394                 'validate'  => 'validateClosed',
00395                 'choices'   => array( 'K' => true, 'M' => true,
00396                         'N' => true ),
00397             ),
00398             'GPSStatus'         => array(
00399                 'map_group' => 'exif',
00400                 'mode'      => XMPReader::MODE_SIMPLE,
00401                 'validate'  => 'validateClosed',
00402                 'choices'   => array( 'A' => true, 'V' => true )
00403             ),
00404             'GPSTimeStamp'      => array(
00405                 'map_group' => 'exif',
00406                 // Note: in exif, GPSDateStamp does not include
00407                 // the time, where here it does.
00408                 'map_name'  => 'GPSDateStamp',
00409                 'mode'      => XMPReader::MODE_SIMPLE,
00410                 'validate'  => 'validateDate',
00411             ),
00412             'GPSTrackRef'       => array(
00413                 'map_group' => 'exif',
00414                 'mode'      => XMPReader::MODE_SIMPLE,
00415                 'validate'  => 'validateClosed',
00416                 'choices'   => array( 'T' => true, 'M' => true )
00417             ),
00418             'GPSVersionID'      => array(
00419                 'map_group' => 'exif',
00420                 'mode'      => XMPReader::MODE_SIMPLE,
00421             ),
00422             'ImageUniqueID'     => array(
00423                 'map_group' => 'exif',
00424                 'mode'      => XMPReader::MODE_SIMPLE,
00425             ),
00426             'LightSource'       => array(
00427                 'map_group' => 'exif',
00428                 'mode'      => XMPReader::MODE_SIMPLE,
00429                 'validate'  => 'validateClosed',
00430                 /* can't use a range, as it skips... */
00431                 'choices'   => array( '0' => true, '1' => true,
00432                     '2' => true, '3' => true, '4' => true,
00433                     '9' => true, '10' => true, '11' => true,
00434                     '12' => true, '13' => true,
00435                     '14' => true, '15' => true,
00436                     '17' => true, '18' => true,
00437                     '19' => true, '20' => true,
00438                     '21' => true, '22' => true,
00439                     '23' => true, '24' => true,
00440                     '255' => true,
00441                 ),
00442             ),
00443             'MeteringMode'      => array(
00444                 'map_group' => 'exif',
00445                 'mode'      => XMPReader::MODE_SIMPLE,
00446                 'validate'  => 'validateClosed',
00447                 'rangeLow'  => 0,
00448                 'rangeHigh' => 6,
00449                 'choices'   => array( '255' => true ),
00450             ),
00451             /* Pixel(X|Y)Dimension are rather useless, but for
00452              * completeness since we do it with exif.
00453              */
00454             'PixelXDimension'   => array(
00455                 'map_group' => 'exif',
00456                 'mode'      => XMPReader::MODE_SIMPLE,
00457                 'validate'  => 'validateInteger',
00458             ),
00459             'PixelYDimension'   => array(
00460                 'map_group' => 'exif',
00461                 'mode'      => XMPReader::MODE_SIMPLE,
00462                 'validate'  => 'validateInteger',
00463             ),
00464             'Saturation'        => array(
00465                 'map_group' => 'exif',
00466                 'mode'      => XMPReader::MODE_SIMPLE,
00467                 'validate'  => 'validateClosed',
00468                 'rangeLow'  => 0,
00469                 'rangeHigh' => 2,
00470             ),
00471             'SceneCaptureType'  => array(
00472                 'map_group' => 'exif',
00473                 'mode'      => XMPReader::MODE_SIMPLE,
00474                 'validate'  => 'validateClosed',
00475                 'rangeLow'  => 0,
00476                 'rangeHigh' => 3,
00477             ),
00478             'SceneType'         => array(
00479                 'map_group' => 'exif',
00480                 'mode'      => XMPReader::MODE_SIMPLE,
00481                 'validate'  => 'validateClosed',
00482                 'choices'   => array( '1' => true ),
00483             ),
00484             // Note, 6 is not valid SensingMethod.
00485             'SensingMethod'     => array(
00486                 'map_group' => 'exif',
00487                 'mode'      => XMPReader::MODE_SIMPLE,
00488                 'validate'  => 'validateClosed',
00489                 'rangeLow'  => 1,
00490                 'rangeHigh' => 5,
00491                 'choices'   => array( '7' => true, 8 => true ),
00492             ),
00493             'Sharpness'         => array(
00494                 'map_group' => 'exif',
00495                 'mode'      => XMPReader::MODE_SIMPLE,
00496                 'validate'  => 'validateClosed',
00497                 'rangeLow'  => 0,
00498                 'rangeHigh' => 2,
00499             ),
00500             'SpectralSensitivity' => array(
00501                 'map_group' => 'exif',
00502                 'mode'      => XMPReader::MODE_SIMPLE,
00503             ),
00504             // This tag should perhaps be displayed to user better.
00505             'SubjectArea'       => array(
00506                 'map_group' => 'exif',
00507                 'mode'      => XMPReader::MODE_SEQ,
00508                 'validate'  => 'validateInteger',
00509             ),
00510             'SubjectDistanceRange' => array(
00511                 'map_group' => 'exif',
00512                 'mode'      => XMPReader::MODE_SIMPLE,
00513                 'validate'  => 'validateClosed',
00514                 'rangeLow'  => 0,
00515                 'rangeHigh' => 3,
00516             ),
00517             'SubjectLocation'   => array(
00518                 'map_group' => 'exif',
00519                 'mode'      => XMPReader::MODE_SEQ,
00520                 'validate'  => 'validateInteger',
00521             ),
00522             'UserComment'       => array(
00523                 'map_group' => 'exif',
00524                 'mode'      => XMPReader::MODE_LANG,
00525             ),
00526             'WhiteBalance'      => array(
00527                 'map_group' => 'exif',
00528                 'mode'      => XMPReader::MODE_SIMPLE,
00529                 'validate'  => 'validateClosed',
00530                 'choices'   => array( '0' => true, '1' => true )
00531             ),
00532         ),
00533         'http://ns.adobe.com/tiff/1.0/' => array(
00534             'Artist'            => array(
00535                 'map_group' => 'exif',
00536                 'mode'      => XMPReader::MODE_SIMPLE,
00537             ),
00538             'BitsPerSample'     => array(
00539                 'map_group' => 'exif',
00540                 'mode'      => XMPReader::MODE_SEQ,
00541                 'validate'  => 'validateInteger',
00542             ),
00543             'Compression'       => array(
00544                 'map_group' => 'exif',
00545                 'mode'      => XMPReader::MODE_SIMPLE,
00546                 'validate'  => 'validateClosed',
00547                 'choices'   => array( '1' => true, '6' => true ),
00548             ),
00549             /* this prop should not be used in XMP. dc:rights is the correct prop */
00550             'Copyright'         => array(
00551                 'map_group' => 'exif',
00552                 'mode'      => XMPReader::MODE_LANG,
00553             ),
00554             'DateTime'          => array( /* proper prop is xmp:ModifyDate */
00555                 'map_group' => 'exif',
00556                 'mode'      => XMPReader::MODE_SIMPLE,
00557                 'validate'  => 'validateDate',
00558             ),
00559             'ImageDescription'  => array( /* proper one is dc:description */
00560                 'map_group' => 'exif',
00561                 'mode'      => XMPReader::MODE_LANG,
00562             ),
00563             'ImageLength'       => array(
00564                 'map_group' => 'exif',
00565                 'mode'      => XMPReader::MODE_SIMPLE,
00566                 'validate'  => 'validateInteger',
00567             ),
00568             'ImageWidth'        => array(
00569                 'map_group' => 'exif',
00570                 'mode'      => XMPReader::MODE_SIMPLE,
00571                 'validate'  => 'validateInteger',
00572             ),
00573             'Make'              => array(
00574                 'map_group' => 'exif',
00575                 'mode'      => XMPReader::MODE_SIMPLE,
00576             ),
00577             'Model'             => array(
00578                 'map_group' => 'exif',
00579                 'mode'      => XMPReader::MODE_SIMPLE,
00580             ),
00581             /**** Do not extract this property
00582              * It interferes with auto exif rotation.
00583              * 'Orientation'       => array(
00584              *  'map_group' => 'exif',
00585              *  'mode'      => XMPReader::MODE_SIMPLE,
00586              *  'validate'  => 'validateClosed',
00587              *  'choices'   => array( '1' => true, '2' => true, '3' => true, '4' => true, 5 => true,
00588              *          '6' => true, '7' => true, '8' => true ),
00589              *),
00590              ******/
00591             'PhotometricInterpretation' => array(
00592                 'map_group' => 'exif',
00593                 'mode'      => XMPReader::MODE_SIMPLE,
00594                 'validate'  => 'validateClosed',
00595                 'choices'   => array( '2' => true, '6' => true ),
00596             ),
00597             'PlanerConfiguration' => array(
00598                 'map_group' => 'exif',
00599                 'mode'      => XMPReader::MODE_SIMPLE,
00600                 'validate'  => 'validateClosed',
00601                 'choices'   => array( '1' => true, '2' => true ),
00602             ),
00603             'PrimaryChromaticities' => array(
00604                 'map_group' => 'exif',
00605                 'mode'      => XMPReader::MODE_SEQ,
00606                 'validate'  => 'validateRational',
00607             ),
00608             'ReferenceBlackWhite' => array(
00609                 'map_group' => 'exif',
00610                 'mode'      => XMPReader::MODE_SEQ,
00611                 'validate'  => 'validateRational',
00612             ),
00613             'ResolutionUnit'    => array(
00614                 'map_group' => 'exif',
00615                 'mode'      => XMPReader::MODE_SIMPLE,
00616                 'validate'  => 'validateClosed',
00617                 'choices'   => array( '2' => true, '3' => true ),
00618             ),
00619             'SamplesPerPixel'   => array(
00620                 'map_group' => 'exif',
00621                 'mode'      => XMPReader::MODE_SIMPLE,
00622                 'validate'  => 'validateInteger',
00623             ),
00624             'Software'          => array( /* see xmp:CreatorTool */
00625                 'map_group' => 'exif',
00626                 'mode'      => XMPReader::MODE_SIMPLE,
00627             ),
00628             /* ignore TransferFunction */
00629             'WhitePoint'        => array(
00630                 'map_group' => 'exif',
00631                 'mode'      => XMPReader::MODE_SEQ,
00632                 'validate'  => 'validateRational',
00633             ),
00634             'XResolution'       => array(
00635                 'map_group' => 'exif',
00636                 'mode'      => XMPReader::MODE_SIMPLE,
00637                 'validate'  => 'validateRational',
00638             ),
00639             'YResolution'       => array(
00640                 'map_group' => 'exif',
00641                 'mode'      => XMPReader::MODE_SIMPLE,
00642                 'validate'  => 'validateRational',
00643             ),
00644             'YCbCrCoefficients' => array(
00645                 'map_group' => 'exif',
00646                 'mode'      => XMPReader::MODE_SEQ,
00647                 'validate'  => 'validateRational',
00648             ),
00649             'YCbCrPositioning'  => array(
00650                 'map_group' => 'exif',
00651                 'mode'      => XMPReader::MODE_SIMPLE,
00652                 'validate'  => 'validateClosed',
00653                 'choices'   => array( '1' => true, '2' => true ),
00654             ),
00655             /********
00656              * Disable extracting this property (bug 31944)
00657              * Several files have a string instead of a Seq
00658              * for this property. XMPReader doesn't handle
00659              * mismatched types very gracefully (it marks
00660              * the entire file as invalid, instead of just
00661              * the relavent prop). Since this prop
00662              * doesn't communicate all that useful information
00663              * just disable this prop for now, until such
00664              * XMPReader is more graceful (bug 32172)
00665              * 'YCbCrSubSampling'  => array(
00666              *  'map_group' => 'exif',
00667              *  'mode'      => XMPReader::MODE_SEQ,
00668              *  'validate'  => 'validateClosed',
00669              *  'choices'   => array( '1' => true, '2' => true ),
00670              * ),
00671              */
00672         ),
00673         'http://ns.adobe.com/exif/1.0/aux/' => array(
00674             'Lens'              => array(
00675                 'map_group' => 'exif',
00676                 'mode'      => XMPReader::MODE_SIMPLE,
00677             ),
00678             'SerialNumber'      => array(
00679                 'map_group' => 'exif',
00680                 'mode'      => XMPReader::MODE_SIMPLE,
00681             ),
00682             'OwnerName'         => array(
00683                 'map_group' => 'exif',
00684                 'map_name'  => 'CameraOwnerName',
00685                 'mode'      => XMPReader::MODE_SIMPLE,
00686             ),
00687         ),
00688         'http://purl.org/dc/elements/1.1/' => array(
00689             'title'             => array(
00690                 'map_group' => 'general',
00691                 'map_name'  => 'ObjectName',
00692                 'mode'      => XMPReader::MODE_LANG
00693             ),
00694             'description'       => array(
00695                 'map_group' => 'general',
00696                 'map_name'  => 'ImageDescription',
00697                 'mode'      => XMPReader::MODE_LANG
00698             ),
00699             'contributor'       => array(
00700                 'map_group' => 'general',
00701                 'map_name'  => 'dc-contributor',
00702                 'mode'      => XMPReader::MODE_BAG
00703             ),
00704             'coverage'          => array(
00705                 'map_group' => 'general',
00706                 'map_name'  => 'dc-coverage',
00707                 'mode'      => XMPReader::MODE_SIMPLE,
00708             ),
00709             'creator'           => array(
00710                 'map_group' => 'general',
00711                 'map_name'  => 'Artist', //map with exif Artist, iptc byline (2:80)
00712                 'mode'      => XMPReader::MODE_SEQ,
00713             ),
00714             'date'              => array(
00715                 'map_group' => 'general',
00716                 // Note, not mapped with other date properties, as this type of date is
00717                 // non-specific: "A point or period of time associated with an event in
00718                 //  the lifecycle of the resource"
00719                 'map_name'  => 'dc-date',
00720                 'mode'      => XMPReader::MODE_SEQ,
00721                 'validate'  => 'validateDate',
00722             ),
00723             /* Do not extract dc:format, as we've got better ways to determine mimetype */
00724             'identifier'        => array(
00725                 'map_group' => 'deprecated',
00726                 'map_name'  => 'Identifier',
00727                 'mode'      => XMPReader::MODE_SIMPLE,
00728             ),
00729             'language'          => array(
00730                 'map_group' => 'general',
00731                 'map_name'  => 'LanguageCode', /* mapped with iptc 2:135 */
00732                 'mode'      => XMPReader::MODE_BAG,
00733                 'validate'  => 'validateLangCode',
00734             ),
00735             'publisher'         => array(
00736                 'map_group' => 'general',
00737                 'map_name'  => 'dc-publisher',
00738                 'mode'      => XMPReader::MODE_BAG,
00739             ),
00740             // for related images/resources
00741             'relation'          => array(
00742                 'map_group' => 'general',
00743                 'map_name'  => 'dc-relation',
00744                 'mode'      => XMPReader::MODE_BAG,
00745             ),
00746             'rights'            => array(
00747                 'map_group' => 'general',
00748                 'map_name'  => 'Copyright',
00749                 'mode'      => XMPReader::MODE_LANG,
00750             ),
00751             // Note: source is not mapped with iptc source, since iptc
00752             // source describes the source of the image in terms of a person
00753             // who provided the image, where this is to describe an image that the
00754             // current one is based on.
00755             'source'            => array(
00756                 'map_group' => 'general',
00757                 'map_name'  => 'dc-source',
00758                 'mode'      => XMPReader::MODE_SIMPLE,
00759             ),
00760             'subject'           => array(
00761                 'map_group' => 'general',
00762                 'map_name'  => 'Keywords', /* maps to iptc 2:25 */
00763                 'mode'      => XMPReader::MODE_BAG,
00764             ),
00765             'type'              => array(
00766                 'map_group' => 'general',
00767                 'map_name'  => 'dc-type',
00768                 'mode'      => XMPReader::MODE_BAG,
00769             ),
00770         ),
00771         'http://ns.adobe.com/xap/1.0/' => array(
00772             'CreateDate' => array(
00773                 'map_group' => 'general',
00774                 'map_name' => 'DateTimeDigitized',
00775                 'mode'     => XMPReader::MODE_SIMPLE,
00776                 'validate' => 'validateDate',
00777             ),
00778             'CreatorTool' => array(
00779                 'map_group' => 'general',
00780                 'map_name'  => 'Software',
00781                 'mode'      => XMPReader::MODE_SIMPLE
00782             ),
00783             'Identifier' => array(
00784                 'map_group' => 'general',
00785                 'mode'      => XMPReader::MODE_BAG,
00786             ),
00787             'Label' => array(
00788                 'map_group' => 'general',
00789                 'mode'      => XMPReader::MODE_SIMPLE,
00790             ),
00791             'ModifyDate' => array(
00792                 'map_group' => 'general',
00793                 'mode'      => XMPReader::MODE_SIMPLE,
00794                 'map_name'  => 'DateTime',
00795                 'validate'  => 'validateDate',
00796             ),
00797             'MetadataDate' => array(
00798                 'map_group' => 'general',
00799                 'mode'      => XMPReader::MODE_SIMPLE,
00800                 // map_name to be consistent with other date names.
00801                 'map_name'  => 'DateTimeMetadata',
00802                 'validate'  => 'validateDate',
00803             ),
00804             'Nickname' => array(
00805                 'map_group' => 'general',
00806                 'mode'      => XMPReader::MODE_SIMPLE,
00807             ),
00808             'Rating' => array(
00809                 'map_group' => 'general',
00810                 'mode'      => XMPReader::MODE_SIMPLE,
00811                 'validate'  => 'validateRating',
00812             ),
00813         ),
00814         'http://ns.adobe.com/xap/1.0/rights/' => array(
00815             'Certificate' => array(
00816                 'map_group' => 'general',
00817                 'map_name'  => 'RightsCertificate',
00818                 'mode'      => XMPReader::MODE_SIMPLE,
00819             ),
00820             'Marked' => array(
00821                 'map_group' => 'general',
00822                 'map_name'  => 'Copyrighted',
00823                 'mode'      => XMPReader::MODE_SIMPLE,
00824                 'validate'  => 'validateBoolean',
00825             ),
00826             'Owner' => array(
00827                 'map_group' => 'general',
00828                 'map_name'  => 'CopyrightOwner',
00829                 'mode'      => XMPReader::MODE_BAG,
00830             ),
00831             // this seems similar to dc:rights.
00832             'UsageTerms' => array(
00833                 'map_group' => 'general',
00834                 'mode' => XMPReader::MODE_LANG,
00835             ),
00836             'WebStatement' => array(
00837                 'map_group' => 'general',
00838                 'mode' => XMPReader::MODE_SIMPLE,
00839             ),
00840         ),
00841         // XMP media management.
00842         'http://ns.adobe.com/xap/1.0/mm/' => array(
00843             // if we extract the exif UniqueImageID, might
00844             // as well do this too.
00845             'OriginalDocumentID' => array(
00846                 'map_group' => 'general',
00847                 'mode'      => XMPReader::MODE_SIMPLE,
00848             ),
00849             // It might also be useful to do xmpMM:LastURL
00850             // and xmpMM:DerivedFrom as you can potentially,
00851             // get the url of this document/source for this
00852             // document. However whats more likely is you'd
00853             // get a file:// url for the path of the doc,
00854             // which is somewhat of a privacy issue.
00855         ),
00856         'http://creativecommons.org/ns#' => array(
00857             'license' => array(
00858                 'map_name'  => 'LicenseUrl',
00859                 'map_group' => 'general',
00860                 'mode'      => XMPReader::MODE_SIMPLE,
00861             ),
00862             'morePermissions' => array(
00863                 'map_name'  => 'MorePermissionsUrl',
00864                 'map_group' => 'general',
00865                 'mode'      => XMPReader::MODE_SIMPLE,
00866             ),
00867             'attributionURL' => array(
00868                 'map_group' => 'general',
00869                 'map_name'  => 'AttributionUrl',
00870                 'mode'      => XMPReader::MODE_SIMPLE,
00871             ),
00872             'attributionName' => array(
00873                 'map_group' => 'general',
00874                 'map_name'  => 'PreferredAttributionName',
00875                 'mode'      => XMPReader::MODE_SIMPLE,
00876             ),
00877         ),
00878         //Note, this property affects how jpeg metadata is extracted.
00879         'http://ns.adobe.com/xmp/note/' => array(
00880             'HasExtendedXMP' => array(
00881                 'map_group' => 'special',
00882                 'mode'      => XMPReader::MODE_SIMPLE,
00883             ),
00884         ),
00885         /* Note, in iptc schemas, the legacy properties are denoted
00886          * as deprecated, since other properties should used instead,
00887          * and properties marked as deprecated in the standard are
00888          * are marked as general here as they don't have replacements
00889          */
00890         'http://ns.adobe.com/photoshop/1.0/' => array(
00891             'City' => array(
00892                 'map_group' => 'deprecated',
00893                 'mode'      => XMPReader::MODE_SIMPLE,
00894                 'map_name'  => 'CityDest',
00895             ),
00896             'Country' => array(
00897                 'map_group' => 'deprecated',
00898                 'mode'      => XMPReader::MODE_SIMPLE,
00899                 'map_name'  => 'CountryDest',
00900             ),
00901             'State' => array(
00902                 'map_group' => 'deprecated',
00903                 'mode'      => XMPReader::MODE_SIMPLE,
00904                 'map_name'  => 'ProvinceOrStateDest',
00905             ),
00906             'DateCreated' => array(
00907                 'map_group' => 'deprecated',
00908                 // marking as deprecated as the xmp prop preferred
00909                 'mode'      => XMPReader::MODE_SIMPLE,
00910                 'map_name'  => 'DateTimeOriginal',
00911                 'validate'  => 'validateDate',
00912                 // note this prop is an XMP, not IPTC date
00913             ),
00914             'CaptionWriter' => array(
00915                 'map_group' => 'general',
00916                 'mode'      => XMPReader::MODE_SIMPLE,
00917                 'map_name'  => 'Writer',
00918             ),
00919             'Instructions' => array(
00920                 'map_group' => 'general',
00921                 'mode'      => XMPReader::MODE_SIMPLE,
00922                 'map_name'  => 'SpecialInstructions',
00923             ),
00924             'TransmissionReference' => array(
00925                 'map_group' => 'general',
00926                 'mode'      => XMPReader::MODE_SIMPLE,
00927                 'map_name'  => 'OriginalTransmissionRef',
00928             ),
00929             'AuthorsPosition' => array(
00930                 /* This corresponds with 2:85
00931                  * By-line Title, which needs to be
00932                  * handled weirdly to correspond
00933                  * with iptc/exif. */
00934                 'map_group' => 'special',
00935                 'mode'      => XMPReader::MODE_SIMPLE
00936             ),
00937             'Credit' => array(
00938                 'map_group' => 'general',
00939                 'mode'      => XMPReader::MODE_SIMPLE,
00940             ),
00941             'Source' => array(
00942                 'map_group' => 'general',
00943                 'mode'      => XMPReader::MODE_SIMPLE,
00944             ),
00945             'Urgency' => array(
00946                 'map_group' => 'general',
00947                 'mode'      => XMPReader::MODE_SIMPLE,
00948             ),
00949             'Category' => array(
00950                 // Note, this prop is deprecated, but in general
00951                 // group since it doesn't have a replacement.
00952                 'map_group' => 'general',
00953                 'mode'      => XMPReader::MODE_SIMPLE,
00954                 'map_name'  => 'iimCategory',
00955             ),
00956             'SupplementalCategories' => array(
00957                 'map_group' => 'general',
00958                 'mode'      => XMPReader::MODE_BAG,
00959                 'map_name'  => 'iimSupplementalCategory',
00960             ),
00961             'Headline' => array(
00962                 'map_group' => 'general',
00963                 'mode'      => XMPReader::MODE_SIMPLE
00964             ),
00965         ),
00966         'http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/' => array(
00967             'CountryCode' => array(
00968                 'map_group' => 'deprecated',
00969                 'mode'      => XMPReader::MODE_SIMPLE,
00970                 'map_name'  => 'CountryCodeDest',
00971             ),
00972             'IntellectualGenre' => array(
00973                 'map_group' => 'general',
00974                 'mode'      => XMPReader::MODE_SIMPLE,
00975             ),
00976             // Note, this is a six digit code.
00977             // See: http://cv.iptc.org/newscodes/scene/
00978             // Since these aren't really all that common,
00979             // we just show the number.
00980             'Scene' => array(
00981                 'map_group' => 'general',
00982                 'mode'      => XMPReader::MODE_BAG,
00983                 'validate'  => 'validateInteger',
00984                 'map_name'  => 'SceneCode',
00985             ),
00986             /* Note: SubjectCode should be an 8 ascii digits.
00987              * it is not really an integer (has leading 0's,
00988              * cannot have a +/- sign), but validateInteger
00989              * will let it through.
00990              */
00991             'SubjectCode' => array(
00992                 'map_group' => 'general',
00993                 'mode'      => XMPReader::MODE_BAG,
00994                 'map_name'  => 'SubjectNewsCode',
00995                 'validate'  => 'validateInteger'
00996             ),
00997             'Location' => array(
00998                 'map_group' => 'deprecated',
00999                 'mode'      => XMPReader::MODE_SIMPLE,
01000                 'map_name'  => 'SublocationDest',
01001             ),
01002             'CreatorContactInfo' => array(
01003                 /* Note this maps to 2:118 in iim
01004                  * (Contact) field. However those field
01005                  * types are slightly different - 2:118
01006                  * is free form text field, where this
01007                  * is more structured.
01008                  */
01009                 'map_group' => 'general',
01010                 'mode'      => XMPReader::MODE_STRUCT,
01011                 'map_name'  => 'Contact',
01012                 'children'  => array(
01013                     'CiAdrExtadr' => true,
01014                     'CiAdrCity'   => true,
01015                     'CiAdrCtry'   => true,
01016                     'CiEmailWork' => true,
01017                     'CiTelWork'   => true,
01018                     'CiAdrPcode'  => true,
01019                     'CiAdrRegion' => true,
01020                     'CiUrlWork'   => true,
01021                 ),
01022             ),
01023             'CiAdrExtadr' => array( /* address */
01024                 'map_group' => 'general',
01025                 'mode'      => XMPReader::MODE_SIMPLE,
01026                 'structPart'=> true,
01027             ),
01028             'CiAdrCity' => array( /* city */
01029                 'map_group' => 'general',
01030                 'mode'      => XMPReader::MODE_SIMPLE,
01031                 'structPart'=> true,
01032             ),
01033             'CiAdrCtry' => array( /* country */
01034                 'map_group' => 'general',
01035                 'mode'      => XMPReader::MODE_SIMPLE,
01036                 'structPart'=> true,
01037             ),
01038             'CiEmailWork' => array( /* email (possibly separated by ',') */
01039                 'map_group' => 'general',
01040                 'mode'      => XMPReader::MODE_SIMPLE,
01041                 'structPart'=> true,
01042             ),
01043             'CiTelWork' => array( /* telephone */
01044                 'map_group' => 'general',
01045                 'mode'      => XMPReader::MODE_SIMPLE,
01046                 'structPart'=> true,
01047             ),
01048             'CiAdrPcode' => array( /* postal code */
01049                 'map_group' => 'general',
01050                 'mode'      => XMPReader::MODE_SIMPLE,
01051                 'structPart'=> true,
01052             ),
01053             'CiAdrRegion' => array( /* province/state */
01054                 'map_group' => 'general',
01055                 'mode'      => XMPReader::MODE_SIMPLE,
01056                 'structPart'=> true,
01057             ),
01058             'CiUrlWork' => array( /* url. Multiple may be separated by comma. */
01059                 'map_group' => 'general',
01060                 'mode'      => XMPReader::MODE_SIMPLE,
01061                 'structPart'=> true,
01062             ),
01063             /* End contact info struct properties */
01064         ),
01065         'http://iptc.org/std/Iptc4xmpExt/2008-02-29/' => array(
01066             'Event' => array(
01067                 'map_group' => 'general',
01068                 'mode'      => XMPReader::MODE_SIMPLE,
01069             ),
01070             'OrganisationInImageName' => array(
01071                 'map_group' => 'general',
01072                 'mode'      => XMPReader::MODE_BAG,
01073                 'map_name'  => 'OrganisationInImage'
01074             ),
01075             'PersonInImage' => array(
01076                 'map_group' => 'general',
01077                 'mode'      => XMPReader::MODE_BAG,
01078             ),
01079             'MaxAvailHeight' => array(
01080                 'map_group' => 'general',
01081                 'mode'      => XMPReader::MODE_SIMPLE,
01082                 'validate'  => 'validateInteger',
01083                 'map_name'  => 'OriginalImageHeight',
01084             ),
01085             'MaxAvailWidth' => array(
01086                 'map_group' => 'general',
01087                 'mode'      => XMPReader::MODE_SIMPLE,
01088                 'validate'  => 'validateInteger',
01089                 'map_name'  => 'OriginalImageWidth',
01090             ),
01091             // LocationShown and LocationCreated are handled
01092             // specially because they are hierarchical, but we
01093             // also want to merge with the old non-hierarchical.
01094             'LocationShown' => array(
01095                 'map_group' => 'special',
01096                 'mode'      => XMPReader::MODE_BAGSTRUCT,
01097                 'children'  => array(
01098                     'WorldRegion' => true,
01099                     'CountryCode' => true, /* iso code */
01100                     'CountryName' => true,
01101                     'ProvinceState' => true,
01102                     'City' => true,
01103                     'Sublocation' => true,
01104                 ),
01105             ),
01106             'LocationCreated' => array(
01107                 'map_group' => 'special',
01108                 'mode'      => XMPReader::MODE_BAGSTRUCT,
01109                 'children'  => array(
01110                     'WorldRegion' => true,
01111                     'CountryCode' => true, /* iso code */
01112                     'CountryName' => true,
01113                     'ProvinceState' => true,
01114                     'City' => true,
01115                     'Sublocation' => true,
01116                 ),
01117             ),
01118             'WorldRegion' => array(
01119                 'map_group' => 'special',
01120                 'mode'      => XMPReader::MODE_SIMPLE,
01121                 'structPart'=> true,
01122             ),
01123             'CountryCode' => array(
01124                 'map_group' => 'special',
01125                 'mode'      => XMPReader::MODE_SIMPLE,
01126                 'structPart'=> true,
01127             ),
01128             'CountryName' => array(
01129                 'map_group' => 'special',
01130                 'mode'      => XMPReader::MODE_SIMPLE,
01131                 'structPart'=> true,
01132                 'map_name'  => 'Country',
01133             ),
01134             'ProvinceState' => array(
01135                 'map_group' => 'special',
01136                 'mode'      => XMPReader::MODE_SIMPLE,
01137                 'structPart'=> true,
01138                 'map_name'  => 'ProvinceOrState',
01139             ),
01140             'City' => array(
01141                 'map_group' => 'special',
01142                 'mode'      => XMPReader::MODE_SIMPLE,
01143                 'structPart'=> true,
01144             ),
01145             'Sublocation' => array(
01146                 'map_group' => 'special',
01147                 'mode'      => XMPReader::MODE_SIMPLE,
01148                 'structPart'=> true,
01149             ),
01150 
01151             /* Other props that might be interesting but
01152              * Not currently extracted:
01153              * ArtworkOrObject, (info about objects in picture)
01154              * DigitalSourceType
01155              * RegistryId
01156              */
01157         ),
01158 
01159         /* Plus props we might want to consider:
01160          * (Note: some of these have unclear/incomplete definitions
01161          * from the iptc4xmp standard).
01162          * ImageSupplier (kind of like iptc source field)
01163          * ImageSupplierId (id code for image from supplier)
01164          * CopyrightOwner
01165          * ImageCreator
01166          * Licensor
01167          * Various model release fields
01168          * Property release fields.
01169          */
01170     );
01171 }