Manual:thumb.php

From MediaWiki.org

Jump to: navigation, search
MediaWiki File: thumb.php
Location: /
Source code: HEAD

1.15.11.14.11.6.12

Classes: None


[edit] Details

Script used to resize images if it is configured to be done when the web browser requests the image and not when generating the page.

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

[edit] 404 Handler

This script can also be used as a 404 handler to generate image thumbs when they don't exist. To use it, set $wgGenerateThumbnailOnParse to false and create a rewrite rule to call this script when a file in $wgUploadPath/thumb/ doesn't exist. If your wiki is in the /wiki directory, something like this should work on apache:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^wiki/images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ /wiki/thumb.php?f=$1&width=$2 [L,QSA]
# If your $wgHashedUploadDirectory is false, remove the first two steps after thumb/



Example: http://www.mediawiki.org/w/thumb.php?f=example.jpg&width=100