3 * Handler for Tiff images.
10 * Handler for Tiff images.
14 class TiffHandler
extends ExifBitmapHandler
{
17 * Conversion to PNG for inline display can be disabled here...
18 * Note scaling should work with ImageMagick, but may not with GD scaling.
20 * Files pulled from an another MediaWiki instance via ForeignAPIRepo /
21 * InstantCommons will have thumbnails managed from the remote instance,
22 * so we can skip this check.
28 function canRender( $file ) {
29 global $wgTiffThumbnailType;
30 return (bool)$wgTiffThumbnailType
31 ||
($file->getRepo() instanceof ForeignAPIRepo
);
35 * Browsers don't support TIFF inline generally...
36 * For inline display, we need to convert to PNG.
42 function mustRender( $file ) {
52 function getThumbType( $ext, $mime, $params = null ) {
53 global $wgTiffThumbnailType;
54 return $wgTiffThumbnailType;
62 function getMetadata( $image, $filename ) {
66 $meta = BitmapMetadataHandler
::Tiff( $filename );
67 if ( !is_array( $meta ) ) {
68 // This should never happen, but doesn't hurt to be paranoid.
69 throw new MWException('Metadata array is not an array');
71 $meta['MEDIAWIKI_EXIF_VERSION'] = Exif
::version();
72 return serialize( $meta );
74 catch ( MWException
$e ) {
75 // BitmapMetadataHandler throws an exception in certain exceptional
76 // cases like if file does not exist.
77 wfDebug( __METHOD__
. ': ' . $e->getMessage() . "\n" );
78 return ExifBitmapHandler
::BROKEN_FILE
;