MediaWiki  REL1_20
Tiff.php
Go to the documentation of this file.
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 
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                                 return serialize( $meta );
00088                         }
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                                 return ExifBitmapHandler::BROKEN_FILE;
00094                         }
00095                 } else {
00096                         return '';
00097                 }
00098         }
00099 }