Extension:PagedTiffHandler
PagedTiffHandler Release status: stable |
|
---|---|
Implementation | Media |
Description | Allows to display tiff-files |
Author(s) | Hallo Welt! Medienwerkstatt GmbH for Wikimedia Deutschland e. V. |
Latest version | continuous updates |
Compatibility policy | Snapshots releases along with MediaWiki. Master is not backward compatible. |
MediaWiki | >= 1.42.0 |
PHP | 7.0+ |
Database changes | No |
License | GNU General Public License 2.0 or later |
Download | |
|
|
Quarterly downloads | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Public wikis using | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Translate the PagedTiffHandler extension if it is available at translatewiki.net | |
Issues | Open tasks · Report a bug |
The PagedTiffHandler extension allows to upload and display tiff-files into your wiki. It can handle multi-paged images and render them into thumbnails on per page basis.
Usage
You can embed images using standard image syntax. Additionally, there are two new parameters:
Parameter | Example | Function |
---|---|---|
page | [[Image:Test.tiff|page=2]] | Renders a thumbnail of the second page of test.tiff. Page numbers start with 1. Default value is 1. |
lossy | [[Image:Test.tiff|lossy=false]] | If set to false, thumbnails are being rendered as png, otherwise as jpg. If no value is set, PagedTiffHandler determines the value based on the presence of an alpha channel. If alpha is there, thumbnail is rendered as png. Possible values for jpg: '1', 'true' and 'lossy'. Possible values for png: '0', 'false' and 'lossless'. |
Pre-requisites
Required
Package | Description | Link |
---|---|---|
"imagemagick" for identify | Does dynamic resizing and thumbnailing of images | www.imagemagick.org |
Type the following in your shell to see if you have the above installed first:
which identify
Required (optionally)
Package | Description | Link |
---|---|---|
"exiv2" for exiv2 | Exiv2 is a Cross-platform C++ library and a command line utility to manage image metadata. Provides support to retrieve EXIF from TIFF files. | www.exiv2.org |
"libtiff-tools" for tiffinfo | Identify and retrieve basic TIFF metadata (more efficient than ImageMagick) | www.simplesystems.org/libtiff/ |
Type the following in your shell to see if you have the above installed first:
which exiv2 tiffinfo
Installation
- <translate> [[<tvar name=2>Special:ExtensionDistributor/PagedTiffHandler</tvar>|Download]] and move the extracted <tvar name=name>
PagedTiffHandler
</tvar> folder to your <tvar name=ext>extensions/
</tvar> directory.</translate>
<translate> Developers and code contributors should install the extension [[<tvar name=git>Special:MyLanguage/Download from Git</tvar>|from Git]] instead, using:</translate>cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/PagedTiffHandler - <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
wfLoadExtension( 'PagedTiffHandler' );
- Configure as required.
- File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>
Configuration
PagedTiffHandler depends on various external programs in order to process Tiff images.
- ImageMagick is used to reject/accept the image and render thumbail images. PagedTiffHandler will not work on any locally uploaded image without ImageMagick.
- tiffinfo can be used to reject/accept the image instead of ImageMagick, but it does not provide rendering (optional).
- Exiv2 is used to extract image metadata (optional).
- VipsScaler extension can be used for fast processing of large image files (optional).
Example configuration:
// Path to identify
$wgImageMagickIdentifyCommand = '/usr/bin/identify';
// Use exiv2? if false, MediaWiki's internal EXIF parser will be used
$wgTiffUseExiv = false;
// Path to exiv2 (MediaWiki core configuration option)
$wgExiv2Command = '/usr/bin/exiv2';
// Use tiffinfo? if false, ImageMagick's identify command will be used
$wgTiffUseTiffinfo = false;
// Path to tiffinfo
$wgTiffTiffinfoCommand = '/usr/bin/tiffinfo';
When thumbnailing very large images to very small sizes, it can be better better to downscale to an intermediary size first, instead of resizing in one go.
By default PagedTiffHandler will downsize images larger than $wgTiffIntermediaryScaleStep (2048 pixels wide by default) first to $wgTiffIntermediaryScaleStep before downsizing to even smaller dimensions.
Example configuration:
// For thumbnails smaller than this, first scale to this amount
// Set to 0 to disable
$wgTiffIntermediaryScaleStep = 2048;
PagedTiffHandler rejects images based on error messages of ImageMagick or tiffinfo. There are three options:
- Images are rejected if the error message matches $wgTiffIdentifyRejectMessages or $wgTiffTiffinfoRejectMessages
- Images are accepted without moaning if the error message matches $wgTiffIdentifyBypassMessages or $wgTiffTiffinfoBypassMessages
- In other cases, images are accepted but the error message is recorded in the image metadata.
Example configuration (all of the parameters show the default configuration):
$wgTiffIdentifyRejectMessages = [
'/^identify: Compression algorithm does not support random access/',
'/^identify: Old-style LZW codes, convert file/',
'/^identify: Sorry, requested compression method is not configured/',
'/^identify: ThunderDecode: Not enough data at scanline/',
'/^identify: .+?: Read error on strip/',
'/^identify: .+?: Can not read TIFF directory/',
'/^identify: Not a TIFF/',
];
$wgTiffIdentifyBypassMessages = [
'/^identify: .*TIFFReadDirectory/',
'/^identify: .+?: unknown field with tag .+? encountered/'
];
PagedTiffHandler also checks a few parameters of the image in order to be able to control the necessary processing time.
Example configuration:
// Maximum number of embedded files in tiff image
$wgTiffMaxEmbedFiles = 10000;
// Maximum size of meta data
$wgTiffMaxMetaSize = 64*1024; // 64kB
When thumbnailing fails for an image, PagedTiffHandler will not try again to render this image for some time. The setting below controls after how many seconds thumbnailing may be tried again.
Example configuration:
// TTL of Cacheentries for Errors
$wgTiffErrorCacheTTL = 84600;
- Defaults
All of the above shown parameters are set as default in the configuration of the extension.
See also
File:Wikimedia-logo black.svg | <translate> This {{<tvar name=1>#ifeq:Extension|Extension</tvar>|extension|skin}} is being used on one or more [[<tvar name=2>m:Special:MyLanguage/Wikimedia projects</tvar>|Wikimedia projects]].</translate> <translate> This probably means that the {{<tvar name=1>#ifeq:Extension|Extension</tvar>|extension|skin}} is stable and works well enough to be used by such high-traffic websites.</translate> <translate> Look for this {{<tvar name=1>#ifeq:Extension|Extension</tvar>|extension's|skin's}} name in Wikimedia's <tvar name=2>CommonSettings.php</tvar> and <tvar name=3>InitialiseSettings.php</tvar> configuration files to see where it's installed.</translate> <translate> A full list of the {{<tvar name=1>#ifeq:Extension|Extension</tvar>|extensions|skins}} installed on a particular wiki can be seen on the wiki's <tvar name=ver>Special:Version</tvar> page.</translate> |
File:OOjs UI icon information-progressive.svg |
- Pages with script errors
- Pages with broken file links
- Stable extensions
- Extensions without an image
- Media handling extensions
- Extensions with release branches compatibility policy
- GPL licensed extensions
- Extensions in Wikimedia version control
- All extensions
- Extensions used on Wikimedia
- Image extensions
- Extensions by HalloWelt