MediaWiki  REL1_19
Jpeg.php
Go to the documentation of this file.
00001 <?php
00016 class JpegHandler extends ExifBitmapHandler {
00017 
00018         function getMetadata ( $image, $filename ) {
00019                 try {
00020                         $meta = BitmapMetadataHandler::Jpeg( $filename );
00021                         if ( !is_array( $meta ) ) {
00022                                 // This should never happen, but doesn't hurt to be paranoid.
00023                                 throw new MWException('Metadata array is not an array');
00024                         }
00025                         $meta['MEDIAWIKI_EXIF_VERSION'] = Exif::version();
00026                         return serialize( $meta );
00027                 }
00028                 catch ( MWException $e ) {
00029                         // BitmapMetadataHandler throws an exception in certain exceptional cases like if file does not exist.
00030                         wfDebug( __METHOD__ . ': ' . $e->getMessage() . "\n" );
00031 
00032                         /* This used to use 0 (ExifBitmapHandler::OLD_BROKEN_FILE) for the cases
00033                          *      * No metadata in the file
00034                          *      * Something is broken in the file.
00035                          * However, if the metadata support gets expanded then you can't tell if the 0 is from
00036                          * a broken file, or just no props found. A broken file is likely to stay broken, but
00037                          * a file which had no props could have props once the metadata support is improved.
00038                          * Thus switch to using -1 to denote only a broken file, and use an array with only
00039                          * MEDIAWIKI_EXIF_VERSION to denote no props.
00040                          */
00041                         return ExifBitmapHandler::BROKEN_FILE;
00042                 }
00043         }
00044 
00045 }
00046