Page MenuHomePhabricator

Document current clients which use thumb URLs as an API
Closed, ResolvedPublic


Most clients get thumbnail URLs via the API (e.g. the imageinfo module) and thus would be unaffected by URL format changes. This task tries to collect which clients use thumb URLs directly as a de facto API instead, and what assumptions those clients have about the URL.

  • MediaViewer: reads an existing image URL from the page, plus the original size encoded as data attributes, and resizes it (logic). Can do thumb->original conversion.
  • mobile media viewer:
  • Mobile Content Service (JavaScript): requests the largest thumbnail it needs then creates a few variations with smaller widths using regex [[;26578326e317f77e41099029562c917d0b330ef3$24 | /(\d+)px- ]].
  • Android app (Java): changes existing thumbnail URLs to smaller widths using regex /(\\d+)px- sometimes.
  • iOS app: Adjusts thumbnail width by looking for px-. Uses data-file-width and data-file-height to ensure the app doesn't request larger than the original. source 1 and source 2
  • DBpedia: Uses /Special:FilePath/ URLs to access 300-pixel wide images (source code)
  • Navigation popups gadget: seems to use imageinfo api
  • Commons Gallery: image info
  • Weekipedia uses a title to construct a thumbnail URL using md5 as thumbnail not present in API request for images. A similar method was previously used in MobileFrontend on queries that returned Wikidata image fields.
  • ...

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
matmarex renamed this task from Document corrent clients which use thumb URLs as an API to Document current clients which use thumb URLs as an API.Dec 17 2016, 8:56 PM

Special:Redirect/file is still kosher, right?

A simple ack-grep --js --php "/thumb" in mediawiki/extensions already finds some interesting stuff.

42:                                                     h = wgFullScriptPath + '/thumb.php?f=' + encodeURIComponent( n ) + '&w=' + sc;

27:             $thumbUrl = $wgCanonicalServer . $wgScriptPath . '/thumb.php?';

MultimediaViewer/resources/mmv/provider/mmv.provider.GuessedThumbnailInfo.js:281:               url = url.replace( '/thumb', '' );

Reading Web maintained extensions (most notably, MobileFrontend, PagePreviews, and RelatedArticles) either use the imageinfo or pageimages API to request their thumbnails. We don't guess thumbnail URLs manually.

Tgr claimed this task.

The Page Previews RESTBase back-end will be creating thumbnails from the original image: T156800.