Manual:thumb.php

From MediaWiki.org
(Redirected from Thumb.php)
Jump to: navigation, search
Translate this page; This page contains changes which are not marked for translation.

Other languages:
català • ‎Deutsch • ‎Ελληνικά • ‎English • ‎español • ‎suomi • ‎français • ‎italiano • ‎日本語 • ‎Bahasa Melayu • ‎Nederlands • ‎polski • ‎português • ‎português do Brasil • ‎中文

Details[edit]

thumb.php is a script used for creating and streaming thumbnails.

To use it, set $wgThumbnailScriptPathManual:$wgThumbnailScriptPath to the path of this file.

Parameters are f for file name, w for width, p for page in multipaged files (if available).

Example: https://commons.wikimedia.org/w/thumb.php?f=Delle_strade_ferrate_e_della_loro_futura_influenza_in_Europa.djvu&w=600&p=206

404 Handler[edit]

This script can also be used as a 404 handler to generate image thumbs when they don't exist. To use it, follow the steps below, then set $wgGenerateThumbnailOnParseManual:$wgGenerateThumbnailOnParse to false. If you have $wgLocalFileRepoManual:$wgLocalFileRepo defined in LocalSettings.php, then you need to also set:

$wgLocalFileRepo['transformVia404'] = true;
Example: https://www.mediawiki.org/w/thumb.php?f=example.jpg&width=100

Scripted transform[edit]

Just add the following code to the bottom of LocalSettings.phpManual:LocalSettings.php.

$wgThumbnailScriptPath = "{$wgScriptPath}/thumb.php";

No web server configuration needed. This will cause thumb.php to either return the file if its already been rendered, or render the file on demand if needed.

See also[edit]