WikidataPageBanner when using page images generated API renders badly cropped images
Closed, ResolvedPublic

Description

This seems specific to MobileFrontend Beta mode. It does not happen in the default/stable mode.

Whenever the page's default associated image is of portrait aspect ratio, the banner brings negative value to the reading experience.

For example: https://en.m.wikipedia.org/wiki/Tank_Girl_(film)

Short the top portion of someone's hair. Poorly cropped and rather pixelated due to it being stretched beyond the nominal size of the original photo. Presumably in a situation like this (bad aspect ratio, image too small) it may be better left out.

Origin of the image:

  • If the autogenerated image by page images is not landscape it should not be used

Guidelines:
a) Do not allow images where width < 1.5 * height.
b) Find out the best place to implement ignoring of banner and implement.

Krinkle created this task.Apr 1 2016, 3:15 AM
Restricted Application added a project: Wikidata. · View Herald TranscriptApr 1 2016, 3:15 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Krinkle updated the task description. (Show Details)Apr 1 2016, 3:15 AM
Lydia_Pintscher moved this task from incoming to monitoring on the Wikidata board.Apr 3 2016, 11:31 AM
Jdlrobson edited subscribers, added: Nirzar; removed: Jdlrobson.
Jdlrobson assigned this task to Nirzar.Apr 21 2016, 4:26 PM
dr0ptp4kt triaged this task as Low priority.Apr 21 2016, 5:12 PM
Jhernandez moved this task from To Triage to Needs Analysis on the Readers-Web-Backlog board.

We should use lead images on layouts > 500px width IF only the image is landscape. we shouldn't use lead images otherwise.

this is a stop-gap solution till I work on solid, good looking, edge case proof layouts for mobile-on-desktop as part of my pet project.

Krinkle removed a subscriber: Krinkle.May 20 2016, 6:46 PM
Jdlrobson moved this task from Tracking to In discussion on the Wikidata-Page-Banner board.
Jdlrobson added a project: Google-Code-In-2016.
Jdlrobson updated the task description. (Show Details)
Jdlrobson removed Nirzar as the assignee of this task.
Jdlrobson renamed this task from WikidataPageBanner (Beta) often renders less-than-useful banners to WikidataPageBanner when using page images generated API renders badly cropped images.
Krinkle removed a subscriber: Krinkle.Nov 15 2016, 4:47 AM
Sumit added a comment.Nov 28 2016, 1:44 PM

does a general solution to ignore banner if image width < 2 *(image height) look acceptable?

@Sumit yes. 1.5 is a usual conversion factor we use for landscape and portrait. width < 1.5 * height.

thanks @Sumit

@Jdlrobson: To clarify, would you like to mentor this in Google-Code-In-2016 (as you added that tag)? Or maybe @Nirzar (see info)? :)

Sumit updated the task description. (Show Details)Nov 29 2016, 3:15 PM
Sumit added a comment.Nov 29 2016, 3:19 PM

@Jdlrobson: To clarify, would you like to mentor this in Google-Code-In-2016 (as you added that tag)? Or maybe @Nirzar (see info)? :)

Imported as https://codein.withgoogle.com/dashboard/tasks/6225877616558080/

I'll be mentoring this one.

Jdlrobson updated the task description. (Show Details)Nov 29 2016, 6:01 PM

I will work to fix it in the next 2 days as a Google Code-in student. As far as I understood the task is to find the corresponding code section and add a check if the image is not landscape, right?

Hi @divadsn - to be more specific any images where the width of the image is less than 1.5 * height.
width:200px, height: 200px would not be allowed (200 < 1.5 * 200)
This should only apply to images generated automatically.
{{PAGEBANNER:SmallImage}} would still work as the editor has specifically overriden the default.

Hopefully the extension page will be of some use :) https://www.mediawiki.org/wiki/Extension:WikidataPageBanner

divadsn added a comment.EditedNov 30 2016, 8:03 PM

@Jdlrobson Thank you for the clarification, now I will setup my dev environment. One question before I start, will vagrant run fine on a old laptop with 4 GB RAM and Ubuntu 16.10 64-bit installation?

Sumit added a comment.Nov 30 2016, 8:04 PM

@Jdlrobson Thank you for the clarification, now I will setup my dev environment. One question, will vagrant run fine on a old laptop with 4 GB RAM and Ubuntu 16.10 64-bit installation?

@divadsn it should be fine but feel free to ask on #wikimedia-dev or #mediawiki irc in case of issue.

Vagrant should be fine. Note that you may need to manually setup WikidataPageBanner (see T152036)

divadsn claimed this task.Nov 30 2016, 11:31 PM

@Jdlrobson Thanks, everything is ready to go! I will reply back when I'm done or when I will have a problem with Vagrant or the code.

Sumit added a comment.Dec 1 2016, 4:16 AM

@divadsn I go by the nick "codezee" on #mediawiki and #wikimedia-mobile on irc. You can ping for help if facing difficulty...

Change 324775 had a related patch set uploaded (by Divadsn):
Fix badly cropped images when using page images

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

Change 324775 had a related patch set uploaded (by Divadsn):
Fix badly cropped images when using page images

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

Change 324775 merged by jenkins-bot:
Fix badly cropped images when using page images

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

Sumit closed this task as Resolved.Dec 2 2016, 7:55 AM

@Jdlrobson what do you mean with this comment here? How should I avoid sending the image to the template when we don't know about the image aspect ratio at that point?
https://gerrit.wikimedia.org/r/#/c/324775/4/includes/WikidataPageBanner.hooks.php@128

Change 325038 had a related patch set uploaded (by Divadsn):
Add check if $options['isAutomatic'] is true

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

Change 325038 abandoned by Divadsn:
Add check if $options['isAutomatic'] is true

Reason:
See change 324884.

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

Change 325038 restored by Jdlrobson:
Add check if $options['isAutomatic'] is true

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

Change 325038 abandoned by Jdlrobson:
Add check if $options['isAutomatic'] is true

Reason:
Whoops.. I see the patch from Thiemo uses empty so I think this is no longer needed. Let me know if I've got that wrong..

Thanks for all the patches! Please keep contributing!! :D

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