Jump to content

手册:thumb.php

From mediawiki.org
This page is a translated version of the page Manual:Thumb.php and the translation is 57% complete.
Outdated translations are marked like this.

细节

thumb.php是一个用于创建和传输缩略图的脚本。

要使用它,请将$wgThumbnailScriptPath 设置为此文件的路径。

可选参数包括:f用于文件名,w用于宽度,p用于包含多页的文件的页数(如果可用)。

Name Required? Description
f Required file name
width Optional width
p Optional page in multipaged files (if available)
lang Optional multi-language SVGs, to render a particular language

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

404 处理器

这个脚本也可用作404处理器,用于在缩略图不存在时将其生成。 要使用它,请按照如下步骤,然后将$wgGenerateThumbnailOnParse 设定为false。如果您在$3中设置了$2,那么您同样需要设置: If you have $wgLocalFileRepo defined in LocalSettings.php, then you need to also set:

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

脚本转换

将下列代码放置在LocalSettings.php 的底部。

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

不需要配制Web服务器。这将导致thumb.php在已生成缩略图时返回文件,或者根据需要按需生成文件缩略图。

参阅