Page MenuHomePhabricator

In article images: Use a higher res image if available and set it to the width of the column text.
Closed, ResolvedPublic2 Estimated Story Points

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Change 205649 had a related patch set uploaded (by Mholloway):
[WIP] Use a higher-res image if available and set it to the width of the column text.

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

An APK would be great so @Etonkovidova and I can do some edge case testing and help you with this.

@Vibhabamba I'll probably want @bearND to have a quick look at the code first but I'll get you and @Etonkovidova an APK shortly. The changes so far are simple code-wise but it seems like there will be some wonky issues to address.

While testing today, I found that certain images edited with a fairly obscure previewing template, "CSS image crop," display incorrectly in fairly unpredictable ways. The template is apparently meant to be used to preview the effects on a page of cropping an image without actually having to download and crop it, with the original image to be replaced with an actually cropped image if the results are satisfactory, but the images as transformed with CSS image crop are nonetheless committed as edits in some cases. CSS image crop has apparently caused problems on mobile for some time, and was at one point nominated for deletion due to its complexity and the tendency to use it incorrectly. It's still around, though @Deskana did some digging and found that only ~0.01% of pages are affected.

Examples of pages with images altered with CSS image crop:
https://en.wikipedia.org/wiki/Tomb_Raider#1996.E2.80.932003:_Tomb_Raider_to_The_Angel_of_Darkness
https://en.wikipedia.org/wiki/Stone_of_Scone
https://en.wikipedia.org/wiki/Seated_Liberty_dollar#Gobrecht_dollar

This is a problem with the underlying content itself and not the app or my changes to it. I understand that @Deskana has or will ask @Moushira to spread the word using CSS image crop correctly.

Please check science articles such as 'Pressure' for the small images being resized, so they are hugely pixellated.

Mholloway, when the images are high resolution, the experience looks great.
Thank you so much for working on this.
It will have big impact on the UX.

I just sent Vibha & Elena an updated APK for testing. This version correctly rendered all of the pages I tested on, but because of the many different ways images can be handled in the HTML that the API sends over, it's likely we will just have to handle edge cases as we find them.

@KHammerstein can you provide guidance for main page images?

@Mholloway lets do full-width images on the main page too, even in the news section. Here's a mock:

main_page-05.png (1×322 px, 325 KB)

@Mholloway Some images still looking fuzzy - for example this in the Puffin article. Is it possible to fix?

Screenshot_2015-04-28-16-42-18.png (1×1 px, 1 MB)

@KHammerstein

Yeah, we should be leaving small images like the puffin stamp alone; that's fixed now.

As for the main page, I've made the change to make those images full-screen as well (and can easily do the same for the featured articles archive), but it seems that main-page thumbnails are sometimes cropped, making them look fuzzy and pixelated when stretched to full screen with; for example, see the screenshot below with today's "in the news" image. If we're sure we want to stretch them, one possible solution would be to fall back to the original image if the image has been cropped for use on the main page, although that would mean diverging from the web in content as well as form.

Screenshot_2015-04-29-10-44-30.png (1×720 px, 403 KB)

Screen_Shot_2015-04-29_at_10.42.00_AM.png (900×1 px, 716 KB)

Original image:

Mustafa_Akinci.jpg (1×2 px, 138 KB)

Have you tested this on tablets?

I have a physical tablet coming today but in the meantime I've been using a Genymotion-emulated tablet (see, e.g., second screenshot above).

Here are a bunch of screenshots from the new tablet (Nexus 9). As you can see, some images when stretched look better than others. Let's talk about how to handle images on tablets.

Screenshot_2015-04-30-11-59-55.png (1×2 px, 209 KB)

Screenshot_2015-04-30-11-59-29.png (2×1 px, 310 KB)

Screenshot_2015-04-30-11-56-16.png (2×1 px, 751 KB)

Screenshot_2015-04-30-11-57-28.png (2×1 px, 1020 KB)

Screenshot_2015-04-30-11-55-56.png (2×1 px, 1 MB)

Screenshot_2015-04-30-11-57-55.png (1×2 px, 1 MB)

Screenshot_2015-04-30-12-00-34.png (2×1 px, 1 MB)

Screenshot_2015-04-30-11-58-24.png (2×1 px, 1 MB)

Screenshot_2015-04-30-12-00-12.png (1×2 px, 1 MB)

Screenshot_2015-04-30-11-57-04.png (1×2 px, 1 MB)

Screenshot_2015-04-30-11-58-49.png (2×1 px, 1 MB)

Screenshot_2015-04-30-11-59-01.png (1×2 px, 2 MB)

@Mholloway For images that are less than 100 px, leave small as discussed, but lets left align them.

Lets increase the space between images and captions by ~5 pixels, so that it has spacing more like on mobile web
Current android:

Screenshot_2015-04-30-15-57-20.png (1×1 px, 892 KB)

Mobile web:

Screenshot_2015-04-30_16.24.00.png (490×794 px, 173 KB)

Also, can we increase the spacing between image+caption divs and the next element? (Wether it is another image or a paragraph).
If so lets increase by ~5 px.

Lets jump on a hangout tomorrow to look over the spacing. Thanks!

New APK sent, with comments from @KHammerstein addressed. This version just takes the larger thumbnail and sets it full-width if it already fills the column, left-aligns it otherwise.

I'm feeling somewhat more optimistic in principle about main page images than yesterday but I want to propose we make that a separate issue/Phab task since it presents additional concerns and seems a bit out of the original scope.

@Mhurd had some good thoughts on this so I'm adding him.

@Mholloway
On tablet, text should wrap around in-article images.

Like this,

Screenshot_2015-05-04_17.36.40.png (896×1 px, 680 KB)

Other than that, looks good!

@Mholloway on desktop and mobile web, some images are aligned left, some aligned right. Can we keep those same alignments for text wrapping?

@KHammerstein done.

Screenshots from the latest version on a tablet:

Screenshot_2015-05-06-15-10-45.png (2×1 px, 735 KB)

Screenshot_2015-05-06-15-10-53.png (2×1 px, 1 MB)

Screenshot_2015-05-06-15-10-36.png (2×1 px, 936 KB)

Screenshot_2015-05-06-15-11-08.png (1×2 px, 851 KB)

Screenshot_2015-05-06-15-11-29.png (1×2 px, 1 MB)

Should I be looking into using something like https://developer.android.com/tools/debugging/systrace.html to analyze the performance impact? Based on my development experience, the impact is very modest.

If there are no objections I'm going to move this to design review since that more accurately reflects its status than "doing."

Change 209588 had a related patch set uploaded (by Mholloway):
Make images larger and higher-resolution

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

@Jdlrobson, I'll address your comments here so we have the benefit of screenshots. Basically, I agree with you that this task would have been better coordinated with all the mobile platforms up front, and I'm not wedded to any of my code in particular, but at this point I have an essentially completed patch that gives Design what they want on Android and results in an improved user experience, I think, so in that spirit:

The main directive from Design, as I understand it, is to always use the highest-quality images available, and to make them larger (full column width for a phone in portrait orientation). The js hack to force grabbing the 2x image from the srcset attribute is essentially to cover the app on phones, where the Android WebView doesn't take the higher-quality image from srcset even though that's what we want (and indeed what happens on the mobile web). On tablets srcset works fine on both platforms. Here are screenshots showing the enlarged image on my cell phone without and with the hack (with a screenshot from the current app production release and mobile web for reference):

Screenshot_2015-05-08-09-36-24.png (1×720 px, 561 KB)

Screenshot_2015-05-08-09-37-26.png (1×720 px, 441 KB)

Screenshot_2015-05-08-09-38-04.png (1×720 px, 370 KB)

Screenshot_2015-05-08-10-03-00.png (1×720 px, 297 KB)

The existing CSS/Less changes are just to accommodate miscellaneous effects of enlarging the images.

Following up from comments on the Gerrit patch mentioned above...

@Jdlrobson makes a good point that MobileFrontend might benefit from this patch.
And in fact, since @Mholloway's implementation turns out to be purely CSS and Javascript, this task could have simply been assigned to the MFE team from the start, with the Apps inheriting the change in the usual way.

@Vibhabamba @KHammerstein @JKatzWMF Do we want this functionality in MFE? If so, it would indeed make more sense to push this change upstream.

So just a note - you probably only want to do this on WiFi or 4G and this is somewhere the apps can excel (on web you can't tell difference and I should probably ire us on side of caution until we know what increase in bandwidth this would cause (cc @phuedx) - create a card Kaity if you want us to work on this.

But Apps team - this is easy. If you look at an image you'll notice srcset. The url is in there where it says 2x! Just extract it and replace the existing url with it when you do your parsoid transformations.

<img alt="Gary Cooper, 1936" src="//upload.wikimedia.org/wikipedia/commons/thumb/7/7d/Gary_Cooper_1936.jpg/100px-Gary_Cooper_1936.jpg" width="100" height="133" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/7/7d/Gary_Cooper_1936.jpg/150px-Gary_Cooper_1936.jpg 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/7/7d/Gary_Cooper_1936.jpg/200px-Gary_Cooper_1936.jpg 2x" data-file-width="451" data-file-height="600">
Just extract it and replace the existing url with it when you do your parsoid transformations.

That's just what the other half of the patch does: https://gerrit.wikimedia.org/r/#/c/205649/

@Mholloway A couple things:

Screenshot_2015-05-06-13-33-15.png (2×1 px, 1 MB)

Some images not left aligned

Screenshot_2015-05-06-13-30-52.png (2×1 px, 2 MB)

Looks weird with small images next to large, not sure what to do about this though. Any thoughts?

Screenshot_2015-05-06-13-30-39.png (2×1 px, 1 MB)

Text overlapping image.

@Kaity these are fixed in changes since the last apk (which i'll send shortly) For #2, though, the pic is still small (though in line with the rest now) because it doesn't meet our minimum size threshold for enlarging.

@KHammerstein I am concerned about full width images on the main page. Here are examples from today's dewiki main page:

Picture at top of page: You have to scroll down quite a bit to get to text.

device-2015-05-12-211005.png (1×768 px, 359 KB)

Some pictures are very pixelated. I doubt it makes a lot of sense to have full-width images on main pages.

device-2015-05-12-211036.png (1×768 px, 632 KB)

Change 209588 merged by jenkins-bot:
Make images larger and higher-resolution

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

@bearND agreed. Main page images are more difficult and should be handled, if at all, as a separate task; we shouldn't be enlarging them here. I've updated the patch to fix this on all wikis.

Change 215506 had a related patch set uploaded (by Mholloway):
Update Less files to accommodate updated image resizing approach

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

Change 215506 merged by jenkins-bot:
Update Less files to accommodate updated image resizing approach

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

Change 205649 merged by jenkins-bot:
Use larger and higher-quality images where appropriate

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

@KHammerstein I am concerned about full width images on the main page. Here are examples from today's dewiki main page:

Picture at top of page: You have to scroll down quite a bit to get to text.

device-2015-05-12-211005.png (1×768 px, 359 KB)

Some pictures are very pixelated. I doubt it makes a lot of sense to have full-width images on main pages.

device-2015-05-12-211036.png (1×768 px, 632 KB)

@bearND It looks like we decided not to do this on main pages. (Based on latest alpha)

@bearND It looks like we decided not to do this on main pages. (Based on latest alpha)

Glad to hear that :)

Checked examples(samples) given in the ticket - all look good. The issue https://phabricator.wikimedia.org/T102296 still is in place.