Release status: stable
|Author(s)||Hallo Welt! Medienwerkstatt GmbH for Wikimedia Deutschland e.V.|
|Latest version||a140cc5 (2013-06-10)|
Translate the PagedTiffHandler extension if possible
|Check usage and version matrix; code metrics|
What can this extension do?[edit | edit source]
With the help of the PagedTiffHandler you can upload Tiff files into your wiki. It can handle multi-paged images and render them into thumbnails on per page basis.
Usage[edit | edit source]
You can embed images using standard image syntax. Additionally, there are two new parameters:
|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'.|
Download[edit | edit source]
You can download the extension directly from the MediaWiki source code repository (browse code). You can get:
- One of the extensions tags
Not all extensions have tags. Some extensions have tags for each release, in which case those tags have the same stability as the release. To download a tag
- Go to the tags list
- Click the name of the tag you want to download
- Click "snapshot"
- The latest version of one of the extensions branches
Each extension has a master branch containing the latest code (might be unstable). Extensions can have further branches as well.
- Go to the branches list
- Click the branch name
- Click "snapshot"
- A snapshot made during the release of a MediaWiki version.
This might be unstable and is not guaranteed to work with the associated MediaWiki version.
After you've got the code, save it into the extensions/PagedTiffHandler directory of your wiki.
If you are familiar with git and have shell access to your server, you can obtain the extension, with all its tags and branches, as follows:
cd extensions git clone
Installation[edit | edit source]
To install this extension,
- copy the extension files to the directory extensions/PagedTiffHandler.
- add the following to LocalSettings.php:
require_once("$IP/extensions/PagedTiffHandler/PagedTiffHandler.php"); #add configuration parameters here
Configuration parameters[edit | edit source]
PagedTiffHandler rejects images based on error messages of ImageMagick. There are three options:
- Images are rejected if the error message matches $wgTiffIdentifyRejectMessages
- Images are accepted without moaning if the error message matches $wgTiffIdentifyBypassMessages
- 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 = array( '/^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 = array( '/^identify: .*TIFFReadDirectory/', '/^identify: .+?: unknown field with tag .+? encountered/' );
PagedTiffHandler depends on various external programs in order to process Tiff images.
- ImageMagick is used to check the image and render thumbail images. This is mandatory, PagedTiffHandler will not work without ImageMagick.
- Exiv2 is used to extract image metadata (optional).
- Vips is an addition to ImageMagick for fast processing of large image files (optional).
For each software in use, a path to the binary file must be provided.
// Path to identify $wgImageMagickIdentifyCommand = '/usr/bin/identify'; // Use exiv2? $wgTiffUseExiv = false; // Path to exiv2 $wgTiffExivCommand = '/usr/bin/exiv2'; // Use vips $wgTiffUseVips = false; // Path to vips $wgTiffVipsCommand = '/usr/bin/vips';
PagedTiffHandler also checks a few parameters of the image in order to be able to control the necessary processing time.
// 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.
// TTL of Cacheentries for Errors $wgTiffErrorCacheTTL = 84600;
Defaults[edit | edit source]
All of the above shown parameters are set as default in the configuration of the extension. In order to override them, just put the override value after you include the extension in LocalSetting.php:
require_once("$IP/extensions/PagedTiffHandler/PagedTiffHandler.php"); $wgTiffMaxEmbedFiles = 150;
See also[edit | edit source]
|This extension is being used on one or more Wikimedia projects. This probably means that the extension is stable and works well enough to be used by such high-traffic websites. Look for this extension's name in Wikimedia's CommonSettings.php and InitialiseSettings.php configuration files to see where it's installed. A full list of the extensions installed on a particular wiki can be seen on the wiki's Special:Version page.|