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