Imrproves and expands thumbnails in MediaWiki.

dev-main 2024-12-03 15:51 UTC

This package is auto-updated.

Last update: 2024-12-03 15:52:01 UTC


README

👍🖼️😎

Thumbro

Can we get Thumbor for the wiki?
We have Thumbor at home.
Thumbor at home:

Thumbro is an in-development MediaWiki extension used to improve and expand thumbnailing in MediaWiki. It is unstable for production use. It is forked from Extension:VipsScaler. Currently, it only supports libvips.

Features

  • Use libvips to render thumbnails instead of ImageMagick and GD
  • Allow custom output options for libvips
  • Render WebP thumbnails by default for gif (animated too!), jpeg, png, webp
  • Allow adding <source> element to the image using the ThumbroBeforeProduceHtml hook
  • Add a hidden anchor element to allow web crawler to crawl the original resolution image (T54647)

Installation

  1. Install libvips. For Debian-based systems:
apt-get install libvips-tools
  1. Download and place the file(s) in a directory called Thumbro in your extensions/ folder.
  2. Add the following code at the bottom of your LocalSettings.php and after all other extensions:
wfLoadExtension( 'Thumbro' );
  1. ✔️Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Configurations

ℹ️ Thumbro works out of the box without any configurations.

$wgThumbroLibraries is used to define the libraries used in Thumbro.

Default:

$wgThumbroLibraries => [
	"value" => [
		"libvips" => [
			"command": "/usr/bin/vipsthumbnail"
		]
	]
];

$wgThumbroOptions is used to define the parameters of the thumbnail generation.

Default:

$wgThumbroOptions = [
	'value' => [
		'image/gif' => [
			'enabled' => true,
			'library' => 'libvips',
			'inputOptions' => [
				'n' => '-1'
			]
		],
		'image/jpeg' => [
			'enabled' => true,
			'library' => 'libvips',
			'inputOptions' => [],
			'outputOptions' => [
				'strip': 'true',
				'Q': '80'
			]
		],
		'image/png': => [
			'enabled' => true,
			'library' => 'libvips',
			'inputOptions' => [],
			'outputOptions' => [
				'strip' => 'true',
				'filter' => 'VIPS_FOREIGN_PNG_FILTER_ALL'
			]
		],
		'image/webp' => [
			'enabled' => true,
			'library' => 'libvips',
			'inputOptions' => [],
			'outputOptions' => [
				'strip' => 'true',
				'Q' => '90',
				'smart_subsample' => 'true'
			]
		]
	]
];

Testing options

Testing Thumbro thumbnails

Thumbro comes with a special page that can be used to compare thumbnails before and after Thumbro. First you have to enable the page with this config:

// Enable the Special:ThumbroTest page
$wgThumbroExposeTestPage = true;

To make sure the before thumbnail is untouched by Thumbro, you can either disable Thumbro site-wide:

// Disable Thumbro site-wide
$wgThumbroEnabled = false;

Or disable the output file format you wanted to test under $wgThumbroOptions.

Requirements

  • MediaWiki 1.39.4 or later
  • libvips 8.14 or later (older versions might work but they are untested)
  • Imagick - Optional, used to generate detailed comparison statistics on Special:ThumbroTest