wiki.techinc.nl/includes/media/Tiff.php
Brian Wolff 19a66a3238 Remove the JPEG/TIFF specific metadata code from BitmapHandler and put it in JpegOrTiff handler
to stop mostly irrelevent classes from getting it.

Also remove a method that is an exact duplicate of a base class (not sure whats with that).

This also coincidently fixes the issue with when a foreign file repo uses PagedTiffHandler
and the local one does not, and the builtin Tiff handler tries to treat the metadata as if
it was its own form.
2011-04-20 23:15:13 +00:00

53 lines
1.4 KiB
PHP

<?php
/**
* Handler for Tiff images.
*
* @file
* @ingroup Media
*/
/**
* Handler for Tiff images.
*
* @ingroup Media
*/
class TiffHandler extends JpegOrTiffHandler {
/**
* Conversion to PNG for inline display can be disabled here...
* Note scaling should work with ImageMagick, but may not with GD scaling.
*/
function canRender( $file ) {
global $wgTiffThumbnailType;
return (bool)$wgTiffThumbnailType;
}
/**
* Browsers don't support TIFF inline generally...
* For inline display, we need to convert to PNG.
*/
function mustRender( $file ) {
return true;
}
function getThumbType( $ext, $mime, $params = null ) {
global $wgTiffThumbnailType;
return $wgTiffThumbnailType;
}
function getMetadata( $image, $filename ) {
global $wgShowEXIF;
if ( $wgShowEXIF && file_exists( $filename ) ) {
$exif = new Exif( $filename );
$data = $exif->getFilteredData();
if ( $data ) {
$data['MEDIAWIKI_EXIF_VERSION'] = Exif::version();
return serialize( $data );
} else {
return JpegOrTiffHandler::BROKEN_FILE;
}
} else {
return '';
}
}
}