Page MenuHomePhabricator

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

Description

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 /(\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

Tgr created this task.Dec 16 2016, 9:32 PM
Restricted Application added projects: Multimedia, Commons. · View Herald TranscriptDec 16 2016, 9:32 PM
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
Tgr updated the task description. (Show Details)Dec 18 2016, 1:27 AM
Gaurav updated the task description. (Show Details)Dec 18 2016, 3:05 AM
Ankry added a subscriber: Ankry.Dec 18 2016, 8:34 AM

Special:Redirect/file is still kosher, right?

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

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

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

MultimediaViewer/resources/mmv/provider/mmv.provider.GuessedThumbnailInfo.js:281:               url = url.replace( '/thumb', '' );
TheDJ updated the task description. (Show Details)Dec 19 2016, 2:11 PM
bearND updated the task description. (Show Details)Dec 19 2016, 4:57 PM
bearND updated the task description. (Show Details)
JoeWalsh updated the task description. (Show Details)Dec 19 2016, 8:29 PM

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.

MarkTraceur moved this task from Untriaged to Tracking on the Multimedia board.Dec 22 2016, 5:23 PM
Jdlrobson updated the task description. (Show Details)Jan 3 2017, 8:40 AM
Tgr closed this task as Resolved.Jan 28 2017, 1:44 AM
Tgr claimed this task.
Ankry removed a subscriber: Ankry.Jan 28 2017, 4:55 PM

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