Manual:thumb.php
MediaWiki File: thumb.php | |
---|---|
Location: | / |
Source code: | |
Classes: | None |
Contents |
Details [edit]
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.
Parameters are f
for file name, w
for width, p
for page in multipaged files (if available).
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 $wgGenerateThumbnailOnParse to false. If you have $wgLocalFileRepo defined in LocalSettings.php, then you need to also set $wgLocalFileRepo['transformVia404'] = true;
MediaWiki >= 1.20 [edit]
Create a rewrite rule to call thumb_handler.php 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_handler.php [L,QSA] # If your $wgHashedUploadDirectory is false, remove the first two steps after thumb/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^wiki/images/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ /wiki/thumb_handler.php [L,QSA] # If your $wgHashedUploadDirectory is false, remove the first two steps after thumb/archive/
MediaWiki <= 1.19 [edit]
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,B] # If your $wgHashedUploadDirectory is false, remove the first two steps after thumb/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^wiki/images/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ /wiki/thumb.php?f=$1&width=$2&archived=1 [L,QSA,B] # If your $wgHashedUploadDirectory is false, remove the first two steps after thumb/archive/
Language: | English • français • polski |
---|