As the first part of FY 25/26 WE 5.4.7 Standardize thumbnail sizes, we want a list of canonical thumbnail sizes in use. This task is an attempt to produce that.
Starting with the easy bits, the set of thumbnail sizes that users can choose are set per-wiki as `wgThumbLimits`, with the default being set by `wmgThumbsizeIndex`:
```lang=php
// Do not add more exceptions.
// Thumbnails must be shared between wikis.
'wgThumbLimits' => [
'default' => [ 120, 150, 180, 200, 220, 250, 300, 400 ],
'+itwikiquote' => [ 360 ],
'svwiki' => [ 120, 200, 250, 300, 360 ],
# nlwiki uses 260 instead of 250 (T215106)
'nlwiki' => [ 120, 150, 180, 200, 220, 260, 300, 400 ],
],
// Do not add more exceptions. Default should stay the same between wikis.
'wmgThumbsizeIndex' => [
'default' => 5,
'svwiki' => 2, // T18739
],
```
So the default is 250 everywhere except nlwiki where it's 260 (per T215106).
The set of thumbnail sizes that are used by default are in `wgThumbnailSteps` (so MW will take other sizes (in all circumstances?) and serve the next-largest one of these instead):
```lang=php
$wgThumbnailSteps = [ 20, 40, 60, 120, 250, 330, 500, 960 ];
```
The set of thumbs that are generated on image upload is defined in `wgUploadThumbnailRenderMap` (I don't think `wgThumbnailBuckets` is used in our deployment, since we don't make size-based thumb buckets?)
```lang=php
// Thumbnail chaining
'wgThumbnailBuckets' => [
'default' => [ 1280 ],
],
'wgThumbnailMinimumBucketDistance' => [
'default' => 100,
],
// Thumbnail prerendering at upload time
'wgUploadThumbnailRenderMap' => [
'default' => [ 320, 640, 800, 1280 ],
'private' => [],
],
```
Users can choose the size of preview they see on file pages on commons from the list defined in `ImageLimits`:
```lang=php
public const ImageLimits = [
'default' => [
[ 320, 240 ],
[ 640, 480 ],
[ 800, 600 ],
[ 1024, 768 ],
[ 1280, 1024 ],
[ 2560, 2048 ],
],
'type' => 'list',
];
```
Extension:MultimediaViewer has a set of MediaViewerThumbnailBucketSizes which I think are the set of thumb sizes it'll restrict user requests to (though I don't get a thumbnailing UI offer from Media Viewer...?):
```lang=json
"MediaViewerThumbnailBucketSizes": {
"description": "Array of preselected widths used to generate thumbnail URLs to avoid arbitrary size requests (see also wgUploadThumbnailRenderMap).",
"value": [
320,
800,
1024,
1280,
1920,
2560,
2880
],
"merge_strategy": "provide_default"
```
It offers a different set of download size options, set in `mmv.ui.utils.js`:
```lang=js
const buckets = {
small: { width: 640, height: 480 },
medium: { width: 1280, height: 720 }, // HD ready = 720p
large: { width: 1920, height: 1080 }, // Full HD = 1080p
xl: { width: 3840, height: 2160 } // 4K = 2160p
};
```
The size in image galleries is set as `wgGalleryOptions`, which is consistent everywhere except svwiki:
```lang=php
'wgGalleryOptions' => [
'default' => [
'imagesPerRow' => 0,
'imageWidth' => 120,
'imageHeight' => 120,
'captionLength' => true,
'showBytes' => true,
'mode' => 'traditional',
],
'+svwiki' => [
'imageWidth' => 150,
'imageHeight' => 150,
],
],
```
So much for the wikis, what about the mobile apps? Here I'm relying on codesearch and rather more guesswork, since I've never looked at the app contents before.
Android first, I find:
```
app/src/main/java/org/wikipedia/Constants.kt
const val PREFERRED_CARD_THUMBNAIL_SIZE = 800
app/src/main/java/org/wikipedia/dataclient/Service.kt
const val PREFERRED_THUMB_SIZE = 320
app/src/main/java/org/wikipedia/places/PlacesFragment.kt
const val THUMB_SIZE = 160
```
The iOS app has a deprecated function in `WMF Framework/WMFArticle+Extensions.h`:
```
@property (nonatomic, nullable) NSURL *thumbnailURL; // Deprecated. Use imageURLForWidth:
```
which has a hardcoded value:
```
return [self imageURLForWidth:240]; //hardcoded to not rely on UIScreen in a model object
```
but I think elsewhere it uses values taken from the following enum:
```lang=c
typedef NS_ENUM(NSInteger, WMFImageWidth) {
/**
* The smallest image width we will show, e.g. in search cell thumbnails.
*
* There's no guarantee about image aspect ratio, so we fetch a little more and use aspect fill.
*/
WMFImageWidthExtraSmall = 60,
/**
* The next-smallest thumbnail we'll show, e.g. in nearby cell thumbnails.
*/
WMFImageWidthSmall = 120,
/**
* A medium width, e.g. POTD & lead images.
*/
WMFImageWidthMedium = 320,
/**
* A slightly larger width, e.g. modal gallery.
*/
WMFImageWidthLarge = 640,
WMFImageWidthExtraLarge = 1280,
WMFImageWidthExtraExtraLarge = 1920
};
```
Finally(?) there's the Android Commons app, which sets `const val THUMB_IMAGE_SIZE = "70px"` and `const val THUMB_HEIGHT_PX = 450` (which is unusual in being height rather than widge).
All told, our list stands at:
20
40
60
70
120
150
160
180
200
220
240
250
260
300
320 [pregenerated]
330
360
400
450 [height setting]
500
640 [pregenerated]
800 [pregenerated]
960
1024
1280 [pregenerated]
1920
2560
2880
3840