Page MenuHomePhabricator

Use standard thumbsizes in mobile frontend search
Closed, ResolvedPublic

Description

Note: This is not about changing the design, the thumbsize for users is 70px and that's not going to change. It's about the size of the thumbnail being fetched from the servers.

Currently mobile frontend search loads thumbnails at random widths, it turns out that it requests at 80px but PageImages responds with 80px in height leading to random values in widths (what we care about)

You should use 60px for width.

This improves performance of loading thumbnails, reduce latency and so on. See T211661#8377883

Event Timeline

It looks like the thumbnail size comes from mw.config.get( 'wgMFThumbnailSizes' ).tiny
https://gerrit.wikimedia.org/g/mediawiki/extensions/MobileFrontend/+/fc1c328807b9f77db53ba877f60834fe091d7249/includes/MobileFrontendHooks.php#556
which is defined here:
https://gerrit.wikimedia.org/g/mediawiki/extensions/MobileFrontend/+/fc1c328807b9f77db53ba877f60834fe091d7249/includes/Models/MobilePage.php#18

This is passed to PageImages API as pithumbsize

We might want to consider this a bug in PageImages API - perhaps we should use buckets there, and find the closest width that matches the criteria?

Alternatively, this might be a little wild.. but we could make MobileFrontend use the same API as desktop search (mapping the response to the required MF values)? I guess the only downside of this approach would be we'd need to keep the existing behaviour for Wikidata which I don't believe works with the desktop REST search API, but it would potentially make migrating to Codex easier on the long run.

ovasileva triaged this task as Medium priority.Nov 17 2022, 3:31 PM
ovasileva moved this task from Incoming to Not ready to estimate on the Web-Team-Backlog board.

Change 859129 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[mediawiki/extensions/PageImages@master] Make sure pithumbsize set width and not height

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

The two patches above would make it standard, from my test in localhost.

It is true that in extremely horizontal images, you might see a broken case, but I'm not sure it would be common enough to require a complex fix. Specially given that it'll be replaced with core's new search in future.

The two patches above would make it standard,

I'm only seeing one?

I've done a before and after comparison of https://gerrit.wikimedia.org/r/859129 on the top page views on 10th October 2022 and it doesn't seem like there is any product risk to this change so I've gone ahead and merged it:
https://jdlrobson.github.io/T323223.html

Change 857016 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[mediawiki/extensions/MobileFrontend@master] Resize thumbnails in mobile page

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

The two patches above would make it standard,

I'm only seeing one?

I somehow forgot to connect one of them, fixed now. Thanks.

I've done a before and after comparison of https://gerrit.wikimedia.org/r/859129 on the top page views on 10th October 2022 and it doesn't seem like there is any product risk to this change so I've gone ahead and merged it:
https://jdlrobson.github.io/T323223.html

I'm fascinated that they actually look better now \o/

This was based on the existing TINY_IMAGE_WIDTH of 80px. I will have to run them again for 60px so bear with me!

Change 859129 merged by jenkins-bot:

[mediawiki/extensions/PageImages@master] Make sure pithumbsize set width and not height

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

This was based on the existing TINY_IMAGE_WIDTH of 80px. I will have to run them again for 60px so bear with me!

{{done}}

image.png (1×1 px, 494 KB)

Change 857016 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] Resize thumbnails in mobile page

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

Jdlrobson claimed this task.

I think is is done now. Please reopen if not. Adding to sprint board for future tracking.