As discussed in #252, we might want to allow the user to edit the associated Wikipedia article to add the image, after the user has successfully uploaded a pic for a Wikidata item. This would complete the "chain" of seamless workflow after the other improvements at #252 are completed during the renewal - users can browse the places that need photos, select one and move to the location, directly upload the photo after taking it (with suggested titles and categories based on the Wikidata item), and THEN add it to the Wikipedia article that is associated with that item.
We could see if the Wikipedia app allows us to do that, or otherwise link to the web view. Otherwise, we could also implement the functionality in our own app if other options don't suit (last resort).
Considerations:
_Edit 30 Jan 2020:_
Scope of task:
Copying from my comment on #865
We could see if the Wikipedia app allows us to do that,
Could you describe a little more about what you expect the app to allow you to do? This might help in assessing the feasibility.
Adding one more,
we could also implement the functionality in our own app if other options don't suit (last resort).
I guess such a situation wouldn't happen.
I like to handle it.
@mithlesh4257 , we really appreciate the offer, but you currently have 2 PRs in the works that have changes requested (for fairly basic things). I would strongly recommend focusing on those, and on learning as much as you can about Git and Android development. You will be able to contribute much more after you do that. ;)
This particular issue is an extremely involved one that we are still unclear on how to best implement (and it is also impossible to implement before #252 is complete). You could try if you really wanted to, but my suggestion is that your effort would be best spent on the things I mentioned.
@sivaraam Sorry I didn't get back to you on that! This has been pushed to the back burner a bit since we have been very busy with the grant tasks and sorting out the urgent crashes, Will have a think on it and get back to you ASAP.
Thanks @misaochan :-)
I was playing around a bit with the Wikipedia links from our Nearby items and noted that 8/10 of the Wikipedia articles that I randomly chose to view actually HAD images. :/ Not just that, but the Commons category that the articles linked to had several other pictures that weren't displayed in the article! I wonder why this isn't reflected in our wikidata items.
This makes me wonder if this is truly a good idea for our next grant. If the majority of articles already have pictures, us directing the user to the mobile edit page might potentially cause more harm than good? Besides, how will they know which section to add the image to?
@sivaraam To answer the question of what we need the Wikipedia app to do, I think that depends on what the "best practices" of adding an image to an article is. My initial thought was that we would want to bring the user to the edit page of a Wikipedia article, and have the text '[[File:name of file that was just uploaded.jpg|thumb|Description that was just given to file]]' in a dialog for them to copy and paste.
To solve this problem, perhaps a more conservative approach might be warranted. Is there a way to check whether the Wikipedia article associated with that Wikidata item has pictures or not? If we can do that, then maybe we can only prompt the user if the article has no pictures, and not otherwise. And see how that goes.
@VojtechDostal @nicolas-raoul What do you guys think?
@misaochan The way Wikipedia images in articles and infoboxes are handles differs wildly between language versions of Wikipedia. In the case of Czech Wikipedia, finding a suitable picture (either in the Wikipedia article or in the corresponding Commons category) which is not associated with the corresponding Wikidata item, is extremely rare, especially for items located in the Czech Republic. The data are quite tidy now. In other parts of the world, the integration of Wikipedia/Commons/Wikidata is not on that level yet.
Also, when you add a picture to Wikidata, any language version of Wikipedia can use this picture automatically using Wikidata modules integrated in infoboxes. Such infoboxes look for locally "added" pictures and if they don't find them, they'll search the corresponding Wikidata item. This means that automatic addition to Wikidata is an adequate solution for Czech Wikipedia. Other Wikipedias might struggle reading those data but it would be very difficult to automate appropriate editing of Wikipedia pages because:
So to sum up, I'd currently recommend rather that Wikipedias try to synchronize their image data with Wikidata (there is actually ongoing work on this in many places) and that they automate the display of Wikidata images in infoboxes.
Thanks so much for the clarification, @VojtechDostal ! :) I guess in that case it is more of an upstream thing, and there isn't really anything efficient that can be done in our app for this purpose?
Indeed in some parts of the world Wikipedia has a picture and Wikidata does not. However:
As @VojtechDostal wrote, the ideal (from a technical point of view) would be for infoboxes/etc to transclude directly from Wikidata.
BUT most local communities are rather suspicious of Wikidata (because they don't control it fully), and would rather copy-paste filenames manually. I actually thought of writing a webapp to add pictures to articles suggested by P18s. But the picture's uploader is the best person for that, though, as they know exactly where/when the picture was taken and maybe a bit of backstory. So the present issue makes sense.
Another argument against automatic transclusion is that pictures need a human-written caption (even in infoboxes). Examples of captions:
Thanks @nicolas-raoul for your insight.
Out of topic: One interesting improvement to consider would be to insert image descriptions into Wikidata as qualifiers. This is quite often done using property P2096. Infoboxes could then read this description when transcluding images from WD. However we'd have to start specifying language of description (our app currently does not do this, right? is there a Github issue for that?)
Is there a way to check whether the Wikipedia article associated with that Wikidata item has pictures or not?
I think you could use the MediaWiki API could be used to get a set of images that belong to a Wikipedia page:
https://www.mediawiki.org/wiki/API:Imageinfo
An example query:
https://en.wikipedia.org/w/api.php?action=query&format=json&prop=imageinfo&titles=Imperative+programming&generator=images
Sorry, here's a better example:
There's a little issue with the API. It seems to return every single image on the page. See, https://phabricator.wikimedia.org/T174564
You could even try out the new /page/media Restbase API which shouldn't have the issue that the MediaWiki API has per comment T174564#4118458
See the /page/media/{title}{/revision} section of https://en.wikipedia.org/api/rest_v1/
Wonderful tip @sivaraam !
Here is a long list of images that are often used as stub/portal/etc icons, and can thus be considered as unrelated to the topic of the article: https://www.wikidata.org/w/index.php?title=User:Magnus_Manske/FIST_icons&action=raw
It is kept up-to-date by FIST/WDFIST users, including me :-)
So the app could download this list once (and maybe update it every month). Then to check whether a Wikipedia article has a picture, call https://en.wikipedia.org/w/api.php?action=query&format=json&prop=imageinfo&titles=A._P._J._Abdul_Kalam&generator=images and remove the images found in FIST_icons.
@nicolas-raoul How about using the /page/media/ RESTBase endpoint instead as note in my comment above regardless of the fact that it's still experimental? The task that developed the endpoint has the following as one of it's requirements:
Identifying images that are too small for a gallery
I thought the app could be one of the early adopters for the endpoint ?? It might help reduce the unwanted work of finding the relevant images to the article from the list of all images.
@nicolas-raoul One possibly off-topic question. Why are the following images part of FIST icons? Moreover, they seem to qualify as a relevant image for an article. What images are FIST icons, anyway (any description/definition)?
I tried the /page/media API, here is the query:
https://en.wikipedia.org/api/rest_v1/page/media/Luca_Ghini
and the result:
{"revision":"787592027","tid":"86d49989-29d8-11e8-a11a-d92a163afa50","items":[{"section_id":0,"type":"image","caption":{"html":"Luca Ghini.","text":"Luca Ghini."},"titles":{"canonical":"File:Ghini.jpg","normalized":"File:Ghini.jpg","display":"File:Ghini.jpg"},"thumbnail":{"source":"http://upload.wikimedia.org/wikipedia/commons/7/70/Ghini.jpg","width":292,"height":412,"mime":"image/jpeg"},"original":{"source":"http://upload.wikimedia.org/wikipedia/commons/7/70/Ghini.jpg","width":292,"height":412,"mime":"image/jpeg"},"file_page":"https://commons.wikimedia.org/wiki/File:Ghini.jpg","artist":{"html":"<span class=\"fn value\"><span lang=\"en\">Unknown</span></span>"},"credit":"From sv: Wikipedia. Originally uploaded 27 februari 2006 kl.11.52 by <a href=\"https://sv.wikipedia.org/wiki/User:213.101\" class=\"extiw\" title=\"sv:User:213.101\">213.101</a> frรฅn <a rel=\"nofollow\" class=\"external autonumber\" href=\"http://www.sma.unibo.it/mm/Ghini.JPG\">[1]</a>","license":{"type":"Public domain"}}]}
The result only contains Ghini.jpg and does not contains Beli-hibiskus.jpg (which is used as a thumbnail), so it is the perfect solution indeed, thanks @sivaraam :-) I would be in favor of using it even if it is experimental.
@nicolas-raoul and @sivaraam Thanks for the pointers! Since checking for Wikipedia articles without pictures appears to be doable (via the /page/media/ endpoint), do you think it would be useful for the app to prompt the user to add their recently-uploaded picture to the Wikipedia article associated with that item, but ONLY if the article has no pictures? It will likely take a substantial amount of work (especially with the additional check), so we would need to decide if the outcome will be worth the while.
@VojtechDostal That is a great suggestion, IMO. Could you create a new issue for it, please? AFAIK, we don't specify language for descriptions.
@nicolas-raoul and @sivaraam Thanks for the pointers! Since checking for Wikipedia articles without pictures appears to be doable (via the /page/media/ endpoint), do you think it would be useful for the app to prompt the user to add their recently-uploaded picture to the Wikipedia article associated with that item, but ONLY if the article has no pictures?
Seems to be a good idea. I guess this would bother the users less and make them do things that add more value (adding a picture to a page that doesn't have any).
I am also all for it :-)
To increase usage of this feature, how about allowing users to do it afterward, not only immediately after uploading?
Scenario:
This does sound really cool Nicolas.
@nicolas-raoul Great idea! Indeed, I think that will be the best way to implement it, much less intrusive.
Yesterday I uploaded a picture and linked it from Wikidata, and I was surprised to see the image appear instantly on the Arabic Wikipedia.
So, it seems like while the big wikipedias do not transclude Wikidata images automatically (and probably won't in the future), some middle-sized wikipedias (probably to balance the lack of editors) have started to :-)
By the way, there is a vote about this (for infoboxes) right now on the English Wikipedia: https://en.wikipedia.org/wiki/Wikipedia:Wikidata/2018_Infobox_RfC
Out of topic: One interesting improvement to consider would be to insert image descriptions into Wikidata as qualifiers. This is quite often done using property P2096. Infoboxes could then read this description when transcluding images from WD. However we'd have to start specifying language of description (our app currently does not do this, right? is there a Github issue for that?)
The app now allows users to specify a language for their descriptions (in the current master, to be released in 2.9 :)). Would it be a good idea to include this in our 2019 plans?
Also, another consideration: What do we do if the user does not have the Wikipedia app installed? Is editing a Wikipedia article via mobile web browser encouraged at all?
Also, another consideration: What do we do if the user does not have the Wikipedia app installed? Is editing a Wikipedia article via mobile web browser encouraged at all?
IMHO, it's better if we could direct users to web editing. For several reasons,
So, editing links gives more flexibility to the user while making things simple for us.
Interesting, so the mobile web version is preferable for editing? That would likely be the easier option for us indeed.
Our Facebook page received this message:
it occurred me to directly try to use an uploaded image to an article in wp
And when I tailored on the image I saw all the details... Plus a "nominate for deletion" option, but no "use this file"
Wouldn't it be a good idea to have an automatically generated string [[file:... |right|thumb|description]] that will make the use of uploaded images through the app easier?
Maybe even two more fields for project (like "bg.wp" for Bulgarian Wikipedia (search suggest?) and another field for the article name.
In this way with the wiki code the user will be able to have the desired article opened in edit mode and just locate the place where to add the image uploaded through the app
My question is, do we plan to include this feature for just our own images in our contributions list, or all images that we can browse via new browse feature?
@neslihanturan I would be in favor of allowing it for any image, since the app is now also very convenient to search for a media.
Being rather risk-averse (understatement? haha ;)), I would prefer to just enable it for own images first, collect statistics on how it is used, and then if statistics are good, enable it for all images (perhaps only for users with a certain level).
I was talking about a text field to copy from the Commons app and paste
into whatever wikipedia editing app/website Ilike. I believe this is pretty
risk-free?
On Mon, Aug 20, 2018, 20:59 Josephine Lim notifications@github.com wrote:
Being rather risk-averse (understatement? haha ;)), I would prefer to just
enable it for own images first, collect statistics on how it is used, and
then if statistics are good, enable it for all images (perhaps only for
users with a certain level).โ
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/commons-app/apps-android-commons/issues/872#issuecomment-414291718,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAGFBqYkdYovjOLYSo9B3CNI9WRdH8lsks5uSqShgaJpZM4PPhlf
.
Ah, I see! That would be somewhat different from this issue, right? Should we create another one?
Yeah, @nicolas-raoul 's idea sounds fairly straight-forward and potentially very useful :-)
@misaochan Can you help in defining the scope of the task. It would be great if the opening comment could be edited to define the scope.
@maskaravivek Sorry for the delay, this actually required a lot more thought than I initially estimated, lol. I will try and get back to you by the weekend.
Sorry for the delay @maskaravivek , I edited the opening comment. Feel free to let me know if you need clarification on anything. :)
Additionally, there are two components of this that I'm not sure about, would greatly appreciate any suggestions @nicolas-raoul @VojtechDostal @dbrant @sivaraam
For the icon, what about this idea:

Hmmm. What is the white square for? I like the idea of using the Wikipedia icon though. :)
I thought empty square indicates lack of image of an article, but considering your question it is not clear enough. I also thought putting a question mark inside the image field. What do you suggest?
Maybe just the Wikipedia icon? Let's see what others say. :)
Maybe the Wikipedia icon and a plus sign? :)
Oh yes, good idea IMO! The small plus sign can be on the upper right of the W icon perhaps?
The user's Wikipedia language version - I am not sure how we can find this. I guess a possible way could be to have a Setting that the user can choose. If we can't, or the user does not choose any setting, maybe we can default to En?
I think its fine to ask the Wikipedia language from the user via a setting. Even the Wikipedia app just asks the users to choose the languages in which the user would like to explore Wikipedia. Also, from my initial exploration I couldn't find an API which would give us that information. It would have been nice if there is a counterpart of Special:MyLanguage that redirects users across wikis ๐
Just to ensure I understand correctly, we're planning to use the Wikipedia language of the user to direct them to edit the article if it misses a picture in the chosen language and use the picture there. Is that correct?
Log (or tag) the edits that are made via our app - I am actually not sure if this can be done since there will be no server-side indication, to the best of my knowledge. From the server point of view, essentially it is just the same as any other mobile web edit
I suppose there might be a way to specify a list of tags using which the edit must be tagged by means of a URL parameter. ๐ค I'm not sure, though. I couldn't find anything in a cursory exploration. Have to dig into this a little more to see if something like that exists.
Regarding the icon, I really like both the ideas: using just a plain Wikipedia logo and a Wikipedia logo with a 'plus' sign that appears on the upper right of icon. It would be nice to actually compare both and decide which looks best.
Just to ensure I understand correctly, we're planning to use the Wikipedia language of the user to direct them to edit the article if it misses a picture in the chosen language and use the picture there. Is that correct?
Yes. :) But I just realized that, AFAIK, when we do the checks on whether a Wikipedia article exists for that item, we only check the EN version (@maskaravivek can you confirm this?). So if we are to do this, we firstly will need an easy way for the user to choose their desired Wikipedia language while in Nearby, and we also need to modify the Nearby query to use that language to begin with.
Here are some more, regarding to comments. My favourite is the first, rounded one.

I actually vote for number 3 (from left to right), because the upload FAB is already a circle, haha. Also I feel they should be smaller than the FAB. But let's see what the others say...
Excuse my ignorance. Where are we actually thinking of placing this icon? :sweat_smile: Would it appear after tapping the FAB that appears after tapping on a Nearby place? Or would it appear somewhere else?
AFAIK, when we do the checks on whether a Wikipedia article exists for that item, we only check the EN version
Apparently "we" are smarter :-)
With my Android's locale set to Japanese, I tapped a pin in Japan, it had a Wikipedia icon. I tapped it, and it directed me to the Japanese Wikipedia article. By the way, that item also has an English Wikipedia article.
Excuse my ignorance. Where are we actually thinking of placing this icon? ๐ Would it appear after tapping the FAB that appears after tapping on a Nearby place? Or would it appear somewhere else?
I'm thinking that after the user has uploaded a photo through Nearby and the photo upload succeeds, it would appear next to the picture in Contributions, maybe overlapping a bit with it on the lower right corner?
Apparently "we" are smarter :-)
With my Android's locale set to Japanese, I tapped a pin in Japan, it had a Wikipedia icon. I tapped it, and it directed me to the Japanese Wikipedia article. By the way, that item also has an English Wikipedia article.
Oh nice!! :D
I'm thinking that after the user has uploaded a photo through Nearby and the photo upload succeeds, it would appear next to the picture in Contributions, maybe overlapping a bit with it on the lower right corner?
Thanks for the clarification. That sounds like an appropriate place for it.
BTW, I think we really have to update the issue title now after all the discussion. The title was what actually confused me ๐
@sivaraam I tried. It was surprisingly hard to capture all that in one sentence. ๐
@sivaraam I tried.
It's good. Just a minor suggestion, I think it would be nice if we could convey that the icon would be per image more clearly.
Here's an alternative suggestion:
In Contributions list, add an icon for images uploaded via Nearby that allows users to use that image in associated Wikipedia article(s)
I'll come to that article(s) part in an upcoming comment.
It was surprisingly hard to capture all that in one sentence. ๐
Oh, don't be surprised. It's true. ๐
"I didn't have time to write a short letter, so I wrote a long one instead." - Mark Twain [ref]
Off topic, you're the second person that I see stating this today. The first one being @b0rk. These coincidences are intriguing. ๐ค
Is there any reason not to show a list of all Wikipedia articles (I mean all language versions of the article) associated with a Nearby uploaded image and let the user decide which version of the article the image should be added to?
I realise that a Wikidata item could contain links to a lot of language versions making it harder for the user to find the ones he wants. We could fix that in a couple of possible ways (or mix of both):
If we do both, then the languages we get from the second one should have precedence over the first.
Just a suggestion that popped in mind. ๐ Let me know if there are other issues that I've missed.
@misaochan Do we need to put this feature to be put specifically in the contribution list or can we have it in the Media details screen where all other media related actions are present.
The issue with adding it in the list is that I will have to make an API call for every single image which was uploaded via nearby in the list to check if the corresponding Wikipedia article contains an image or not. It would add undue complexity in the list.
If we load asynchronously little by little, and cache the information, I guess it will not slow down the app much? If we check for many languages that might be more severe, though.
Downloading the wikicode of the article and checking for "[[File:" or other language equivalents might be enough. We should get the non-transcluded wikicode, because for instance https://en.wikipedia.org/wiki/Souvign%C3%A9-sur-M%C3%AAme has 5 images but all transcluded.
Downloading the wikicode of the article and checking for "[[File:" or other language equivalents might be enough.
I was of the impression that we were going to use the /page/media API to fetch the images used in the article. Even the description of this issue says so. Did I miss anything? ๐ค
@maskaravivek I understand, but I strongly feel that if the user must enter media details view in order to see this, the feature will be used far less frequently than if it was on the main contributions list. Unlike the other actions, this option will probably not be present for the majority of a user's images, so it would be burdensome for them to go through every one of their pics individually to see which ones are applicable (which means they will probably just not do it). As Nicolas says, loading asynchronously should help with performance? If anyone else feels differently, please do chime in. :)
Is there any reason not to show a list of all Wikipedia articles (I mean all language versions of the article) associated with a Nearby uploaded image and let the user decide which version of the article the image should be added to?
IMO this would add undue complexity, especially as this is our first time rolling out the feature. I think it may be best to simply use the phone's language as the default for the time being, and then add this enhancement later if desired.
I was of the impression that we were going to use the /page/media API to fetch the images used in the article. Even the description of this issue says so.
Yes, I am of that impression too. ;)
Loading the contributions page by page sounds good. I have started a WIP PR(#3566) that loads contributions 10 at a time and loads more on scrolling down. Having it in place would make this task easier. @ashishkumar468 has volunteered to help me with this PR(ie. #3566).
@sivaraam Oops I forgot that, sorry ๐
I am going to use the following API to check if the Wikipedia page contains media or not.
https://en.wikipedia.org/api/rest_v1/page/media-list/A._P._J._Abdul_Kalam
@neslihanturan Can you export the 3rd icon separately and share it here. In your comment above all icons are in the same image.
Prior to entering the editor, we should have a popup with basic instructions of what to do, and the wikicode for that image displayed for easy copying
@misaochan Can you help me with text for the instructions.
Also, I was planning to directly copy the wikicode to the clipboard and show this on the instructions dialog (along with the instructions).
"Wikicode has been copied to the clipboard"
I think it's good to check with the legal team about the modified version of the Wikipedia logo. It shouldn't be a problem if we haven't changed it. But we have added a plus icon and the Wikipedia Visual identity guidelines mentions:
Do not... ^
...alter the Wikipedia or related project identities nor any of their elements.
So, it would be good to check with the legal team about this.
For the instructions, @nicolas-raoul would you have any suggestions on what we should tell them? I actually am not that familiar with wikipedia editing, haha.
Good idea @sivaraam , I'll contact the legal team just to be sure.
I am going to use the following API to check if the Wikipedia page contains media or not.
en.wikipedia.org/api/rest_v1/page/media-list/A._P._J._Abdul_Kalam
On reading this initially and searching, I realised that the /page/media API is missing from the API page. I've wondered what happened to that API. I happened to come across an answer for it now. Links to related phba tickers for reference:
Most helpful comment
I am also all for it :-)
To increase usage of this feature, how about allowing users to do it afterward, not only immediately after uploading?
Scenario: