Page MenuHomePhabricator

Make PCS respect standard sizes
Closed, ResolvedPublic

Description

Currently PCS‌is serving 500px, 750px, and 1000px which will be blocked/rate limited

See example: https://en.wikipedia.org/api/rest_v1/page/media-list/Cat

Event Timeline

I have a WIP patch here:
https://gerrit.wikimedia.org/r/c/mediawiki/services/mobileapps/+/1234441

The problem is that even though mobile-html output fixes up the thum sizes to the common thumbnail sizes, for media list we do the following:

  • For each of the images on the img.srcset
    • We parse the multiplier
    • Update the px size of the thumb according to the multiplier
    • This leads to unexpected sizes

My proposal is to just find the closest available common size and fixup with that value instead.
There are 2 questions though related to apps (cc @Tsevener @Dbrant)

  • Is that going to cause any issues on the apps side. From what we've discussed the media-list is used to fetch images for offline usage.
  • How should we handle the fixed up version of the srcset multiplier
    • Should we just leave it as it is and use the adjusted size causing inconsistency between the value and the semantics?
    • Fix up the multiplier too causing random multipliers?

Change #1234441 had a related patch set uploaded (by Jgiannelos; author: Jgiannelos):

[mediawiki/services/mobileapps@master] common thumbnnail sizes: Pick closest candidate

https://gerrit.wikimedia.org/r/1234441

Something to consider: You can get rid of 1.5x IMHO. It is removed from mediawiki from what I'm seeing. One less thing to adjust.

Something to consider: You can get rid of 1.5x IMHO. It is removed from mediawiki from what I'm seeing. One less thing to adjust.

I confirmed with @Krinkle that 1.5x has should be removed (as much as possible). It would be much better if that code path would use our API‌ for building thumb url. Example: https://commons.wikimedia.org/w/api.php?action=query&titles=File:Albert%20Einstein%20Head.jpg&prop=imageinfo&iiurlwidth=100&iiprop=url (that also has 2x and 1.5x url too even).

Change #1234441 merged by jenkins-bot:

[mediawiki/services/mobileapps@master] common thumbnnail sizes: Pick closest candidate

https://gerrit.wikimedia.org/r/1234441