From 6ebba897f1f891d3a73cadfa1424a09e54d1f0f8 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 16 Mar 2009 22:03:20 +0000 Subject: [PATCH] * (bug 17714) Limited TIFF upload support now built in if 'tif' extension is enabled. Image width and height are now recognized, and when using ImageMagick, optional flattening to PNG or JPEG for inline display can be enabled by setting $wgTiffThumbnailType By default no thumbnailing will occur; only difference from previous will be that the image width/height is detected and displayed. Not yet implemented: * Multi-page support * Cleverer thumbnailing for giant files * Thumbnailing of any sort if not using ImageMagick --- RELEASE-NOTES | 4 ++++ includes/AutoLoader.php | 1 + includes/DefaultSettings.php | 11 +++++++++++ includes/media/Tiff.php | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 49 insertions(+) create mode 100644 includes/media/Tiff.php diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 6ee3e0d921..2a21d5e7eb 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -141,6 +141,10 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 4582) Provide preference-based autoformatting of unlinked dates with the dateformat parser function. * (bug 17886) Special:Export now allows you to export a whole namespace (limited to 5000 pages) +* (bug 17714) Limited TIFF upload support now built in if 'tif' extension is + enabled. Image width and height are now recognized, and when using ImageMagick, + optional flattening to PNG or JPEG for inline display can be enabled by setting + $wgTiffThumbnailType === Bug fixes in 1.15 === * (bug 16968) Special:Upload no longer throws useless warnings. diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index 07c579d130..85e7e6685b 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -189,6 +189,7 @@ $wgAutoloadLocalClasses = array( 'StringUtils' => 'includes/StringUtils.php', 'TablePager' => 'includes/Pager.php', 'ThumbnailImage' => 'includes/MediaTransformOutput.php', + 'TiffHandler' => 'includes/media/Tiff.php', 'TitleDependency' => 'includes/CacheDependency.php', 'Title' => 'includes/Title.php', 'TitleArray' => 'includes/TitleArray.php', diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 93577b007f..06bafc92c0 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1997,6 +1997,7 @@ $wgMediaHandlers = array( 'image/jpeg' => 'BitmapHandler', 'image/png' => 'BitmapHandler', 'image/gif' => 'BitmapHandler', + 'image/tiff' => 'TiffHandler', 'image/x-ms-bmp' => 'BmpHandler', 'image/x-bmp' => 'BmpHandler', 'image/svg+xml' => 'SvgHandler', // official @@ -2074,6 +2075,16 @@ $wgMaxImageArea = 1.25e7; * Defaulting to 1 megapixel (1000x1000) */ $wgMaxAnimatedGifArea = 1.0e6; +/** + * Browsers don't support TIFF inline generally... + * For inline display, we need to convert to PNG or JPEG. + * Note scaling should work with ImageMagick, but may not with GD scaling. + * // PNG is lossless, but inefficient for photos + * $wgTiffThumbnailType = array( 'png', 'image/png' ); + * // JPEG is good for photos, but has no transparency support. Bad for diagrams. + * $wgTiffThumbnailType = array( 'jpg', 'image/jpeg' ); + */ +$wgTiffThumbnailType = false; /** * If rendered thumbnail files are older than this timestamp, they * will be rerendered on demand as if the file didn't already exist. diff --git a/includes/media/Tiff.php b/includes/media/Tiff.php new file mode 100644 index 0000000000..9d3fbb785f --- /dev/null +++ b/includes/media/Tiff.php @@ -0,0 +1,33 @@ +