Extension:Thumbro

Category:Extensions without an imageCategory:GPL licensed extensions
MediaWiki extensions manual
Thumbro
Release status: betaCategory:Beta status extensions
Implementation MediaCategory:Media handling extensions
Description Improve and expand thumbnailing in MediaWiki
Author(s) alistair3149, Bryan Tong Minh
Latest version 0.1.0 (Continuous updates)
Compatibility policy Master maintains backward compatibility.Category:Extensions with master compatibility policy
MediaWiki 1.39.4+Category:Extensions with manual MediaWiki version
Composer starcitizentools/thumbroCategory:Extensions supporting Composer
License GNU General Public License 2.0 or later
Download Category:Extensions in GitHub version control
Readme
  • $wgThumbroLibraries
  • $wgThumbroEnabled
  • $wgThumbroTestExpiry
  • $wgThumbroExposeTestPage
  • $wgThumbroOptions
  • thumbro-test
Category:All extensions

The Thumbro extension improves and expands thumbnailing in MediaWiki. It is a forked and rewritten version of Extension:VipsScaler.

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

  • Install libvips
  • Download and place the file(s) in a directory called Thumbro in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'Thumbro' );
    
  • Yes 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.

Key Description
command Executable used by Thumbro to do image transformation

Default:

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

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

Key Description
enabled Enable or disable Thumbro for the selected file type
library Corresponds to $wgThumbroLibraries, currently only libvips is supported
inputOptions Corresponds to the input/load options in VipsForeignSave
outputOptions Corresponds to the output/save options in VipsForeignSave

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

Name Description Values Default
$wgThumbroEnabled Set to false to disable Thumbro throughout the wiki excluding the Special:ThumbroTest page true - enable; false - disable true
$wgThumbroExposeTestPage Enable Special:ThumbroTest on the wiki true - enable; false - disable false
$wgThumbroTestExpiry Control the cache age for the test image streamed to Special:ThumbroTest integer 3600

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.

See also

Category:Image extensions
Category:All extensions Category:Beta status extensions Category:BitmapHandlerCheckImageArea extensions Category:BitmapHandlerTransform extensions Category:Extensions in GitHub version control Category:Extensions supporting Composer Category:Extensions with manual MediaWiki version Category:Extensions with master compatibility policy Category:Extensions without an image Category:GPL licensed extensions Category:Image extensions Category:Media handling extensions Category:SoftwareInfo extensions