Manual talk:Thumb.php

Latest comment: 7 years ago by Ciencia Al Poder in topic Why run the thumb script in nginx rule?

After some changes in MW configuration thumb script refused to work (it worked in the very beginning, I'm sure of that) - I mean, browser waits for its answer for eternity. After I wrote

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

(what has always been true), it generates frames but there are no images inside. What could it mean? MediaWiki 1.13.2, PHP 5.2.9-2 (apache2handler), MySQL 5.0.67-community-nt

I have this problem with PHP Safe mode, (which I can't disable). This is because it's still trying to write the thumbnail to the images\thumb directory. It needs to be creating the thumbnail and streaming it to the client instead. When you say it was working before, I'm guessing it was just using client scaling, i.e. it was sending the full size image and relying on the client's browser to squish it down.

Rewrite rule for lighttpd

edit
    url.rewrite-if-not-file += (
        "^/w/images/thumb/[0-9a-f]/[0-9a-f]{2}/([^/]+)/(\d+)px" => "/w/thumb.php?f=$1&width=$2",
        "^/w/images/thumb/archive/[0-9a-f]/[0-9a-f]{2}/([^/]+)/(\d+)px" => "/w/thumb.php?f=$1&width=$2&archived=1"
    )

Requires lighttpd 1.4.24+. --Tgr (talk) 08:23, 10 March 2012 (UTC)Reply

Doh. Just after wasting two hours on this (lighttpd mod_rewrite handling sucks BIG TIME), I found Daniel Friesen's amazing MediaWiki ShortURL Builder which generates the full configuration after two clicks. --Tgr (talk) 13:28, 10 March 2012 (UTC)Reply

For Apache

edit

I have this version:

  • Server version: Apache/2.2.22 (Ubuntu)
  • Server built: Mar 19 2014 21:11:10

And it works only with %{DOCUMENT_ROOT}:

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteRule ^images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/[^/]+/[^/]+$ /thumb_handler.php [L,QSA]

Please, attend!

Why disabled by default?

edit

This seems to be an important feature as it generates thumbnail images when they are needed and not just by default. Are there any reasons not to work with this? I've found the follwonig line in includes/DefaultSettings.php:

- thumbScriptUrl   The URL for thumb.php (optional, not recommended)

It is part of the description of "File repository structures" and it confuses me :) --Osnard (talk) 07:14, 4 May 2015 (UTC)Reply

Why run the thumb script in nginx rule?

edit

Because it already creates the thumb when thumb.php is called from the rewrite?

Then why not run it in the Apache rule as well? --Subfader (talk) 13:21, 31 October 2017 (UTC)Reply

Because apache often uses php as a shared module, being invoked automatically whenever it targets a *.php file, while nginx can't use it as a shared module and needs to be called explicitly as fastcgi. --Ciencia Al Poder (talk) 21:07, 31 October 2017 (UTC)Reply
Return to "Thumb.php" page.