Page MenuHomePhabricator

Spike: Media Viewer bucket sizes smallest bucket is not the expected size if not in wgThumbnailSteps
Open, LowPublicSpike

Description

Follow-up to config tweaks from T372165

We had set 400 pixels as the lower bucket for wgMediaViewerThumbnailBucketSizes and the config came through correctly in production, but the minimum size we were seeing used on some pages is 500px on certain examples where there was not a thumbnail image to pull URLs from (eg the fullsize image is loaded):

Versus a page with a thumbnail where MultimediaViewer tries to guess the proper thumbnail URLs by rewriting them:

Per early discussion on this task we confirmed that this _should_ be giving back 500 as per the steps in wgThumbnailSteps however this logic only gets run when asking the server for a URL via API. If there was a thumbnail on the page being pulled from, MultimediaViewer is skipping around that and just asks for whatever size it wants.

Things to look into for a spike:

  • can we clean up the Thumbnail url helper classes to respect wgThumbnailSteps?
  • is there already some core JS logic we can piggyback on to reduce code bloat/duplication?
  • do we have to audit for similar code elsewhwere?

Event Timeline

That's due to T360589: De-fragment thumbnail sizes in mediawiki meaning that's intentional and shouldn't change 😅

@Ladsgroup Woohoo! I thought it might be something like that. On a slight investigation:

  • _if there is a resized thumbnail on the wiki page_ the *400px version does load*:

https://test.wikipedia.org/wiki/Image-bucket-test2#/media/File:File,_Asu%C3%A1n,_Egipto,_2022-04-01,_DD_142.jpg

  • _if there is only a fullsize image, not a resized image, the *500px version* is loaded in its place_

This appears to be because if it sees a parseable thumb URL MediaViewer will replace the size in the URL to create a new loadable URL, whereas it will do an API hit for server-side thumb URL generation if it doesn't recognize a thumbnail link. The server-side generation then follows the limits from $wgThumbnailSteps and comes back with a 500px thumbnail.

So the behavior in MediaViewer is still inconsistent and should be cleaned up, but we probably should go ahead and bump up the config as well to make it consistent.

bvibber renamed this task from Spike: Media Viewer bucket sizes smallest bucket is not the expected size to Spike: Media Viewer bucket sizes smallest bucket is not the expected size if not in wgThumbnailSteps.Nov 19 2025, 10:12 PM
bvibber updated the task description. (Show Details)

Sounds good to me! Let me know if I can help on anything.

egardner changed the subtype of this task from "Task" to "Spike".
egardner added a project: MediaViewer.
egardner moved this task from Incoming/Inbox to Backlog on the Reader Growth Team board.

I think that's a different issue, but I found a different one around the same time (T424071) which might be closer in root cause to this one.