MediaWiki
REL1_23
|
00001 <?php 00029 class TiffHandler extends ExifBitmapHandler { 00041 function canRender( $file ) { 00042 global $wgTiffThumbnailType; 00043 00044 return (bool)$wgTiffThumbnailType 00045 || $file->getRepo() instanceof ForeignAPIRepo; 00046 } 00047 00055 function mustRender( $file ) { 00056 return true; 00057 } 00058 00065 function getThumbType( $ext, $mime, $params = null ) { 00066 global $wgTiffThumbnailType; 00067 00068 return $wgTiffThumbnailType; 00069 } 00070 00077 function getMetadata( $image, $filename ) { 00078 global $wgShowEXIF; 00079 if ( $wgShowEXIF ) { 00080 try { 00081 $meta = BitmapMetadataHandler::Tiff( $filename ); 00082 if ( !is_array( $meta ) ) { 00083 // This should never happen, but doesn't hurt to be paranoid. 00084 throw new MWException( 'Metadata array is not an array' ); 00085 } 00086 $meta['MEDIAWIKI_EXIF_VERSION'] = Exif::version(); 00087 00088 return serialize( $meta ); 00089 } catch ( MWException $e ) { 00090 // BitmapMetadataHandler throws an exception in certain exceptional 00091 // cases like if file does not exist. 00092 wfDebug( __METHOD__ . ': ' . $e->getMessage() . "\n" ); 00093 00094 return ExifBitmapHandler::BROKEN_FILE; 00095 } 00096 } else { 00097 return ''; 00098 } 00099 } 00100 }