手册:thumb.php

From mediawiki.org
This page is a translated version of the page Manual:Thumb.php and the translation is 100% complete.

细节

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

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

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

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

404 处理器

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

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

脚本转换

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

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

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

参见