Community Wishlist Survey 2023/Add ability to share QR code for a page in any Wikimedia project

The sharing QR Codes project is a Community Tech project to implement a solution to the #19 proposal on the 2023 Community Wishlist Survey. The project aims to make it easy for anyone to create and use QR Codes for URLs related to Wikimedia projects.

Discussion for this project is on Talk:Community Wishlist Survey 2023/Add ability to share QR code for a page in any Wikimedia project.

Key features

edit
  1. Form for creating QR Codes with various options.
  2. Input URL information either by wiki page name or direct URL entry.
  3. Integrate shortened URLs (i.e. https://w.wiki URLs).
  4. Navigation in key places to quickly get to the form.
  5. Ability to download the codes in SVG and PNG file formats.
  6. Option for adding Wikimedia logos to the middle of the codes.

Implementation decisions

edit

We toyed with the idea of making a new extension, but ultimately decided it should be part of UrlShortener, since the purposes of sharing QR codes are similar to the purpose of sharing short URLs.

In addition, we settled on using the endroid/qr-code PHP package for QR code generation. This is because it was observed that the various clientside solutions would require the user to first download the JavaScript module that generates the QR code, which ends up being larger than the QR code itself. Thus, it is cheaper for our users for us to instead generate the QR code server-side.

Additionally, we decided to shorten URLs used in QR codes only if they are very long (roughly 200 bytes). This is because users want to see a familiar URL when scanning a QR code, but if the URL is too long, then the pixel density of the QR code will be too high and hence must be shortened.

Updates

edit
2024-02-02
QR Codes are now deployed to all WMF wikis (see Special:QrCode). We may later explore adding new features, such as adding a logo in the QR code.
2023-10-04
The first patch has been merged and will soon be available for testing on Beta English Wikipedia (phab:T348487). The new Special:QrCode page is still under development (phab:T341361).
2023-09-29
The security review for the QR code generator library has been approved, and now development can proceed further.
2023-06-25
It was decided that we will build this as part of Extension:UrlShortener, and will use the endroid/qr-code PHP library for generating the images. The library must first pass security review, which is estimated to be completed by or before September 2023.
2023-05-08
Investigated as part of a Community Tech internal Wishathon. Notes collated in an etherpad and in Figma. Existing projects were summarized at mw:QR Codes.
2023-05-17
This project page created, along with the #qr-share Phabricator project.

Notes

edit

The following are notes from the investigation:

  • A trademark indication is needed if we use the phrase 'QR Code' anywhere. Per the FAQ: "To use the word 'QR Code' in your publications or web site, etc, please indicate a sentence QR Code is registered trademark of DENSO WAVE INCORPORATED."
    • We could vote for another name / indicator, e.g. 'WikiQR', 'WQR', or thinking out of the box: 'Quick QR' (referring to wiki=quick), 'Universal QR' (referring to universal=all WMF sites), 'QREW' (Quick Response Code on Every Wiki), etc.
  • Shorter URLs make for simpler/smaller QR Codes, so using URLShortener (https://w.wiki) or mw:Extension:ShortUrl can help. This shouldn't be done automatically for all codes because when someone scans one they are prompted with the URL and it's better if it's recognisable.
    • Add QR Code to the Special:UrlShortener page for https://w.wiki
    • The QR Code image also included the shortened URL at the bottom of the image (in a case if the QR Code is broken), eg. https://w.wiki/exmpl
  • Would be nice to handle page shortcuts, e.g. on Community Wishlist Survey 2023 the code could default to https://meta.wikimedia.org/wiki/CWS23 (if there were a way of querying what the preferred shortcut is for a page, which there isn't).
  • A common use for QR Codes is for printing, e.g. for a photography exhibition, so a way to download codes en masse would be good, e.g. via a textbox or uploaded file.
    • If this is downloadable, then next iteration could try to make it uploadable to Commons immediately. (even if it's just a simple link to ask the person to upload it to Special:UploadWizard in Commons)
  • It may be useful to add a QR Code to the default print view of a wiki page, i.e. alongside the 'Retrieved from "x"' URL.
  • There doesn't appear to be any reason to limit QR Code creation to only Wikimedia URLs. Some existing tools already allow any URLs.
  • There are various tools that create useful views of information intended to be used as the target of QR Codes (e.g. QRPedia, QRmedia, Free Knowledge Portal, Taxon-Info).
  • The 2023 wish talks of a GLAM partner using a QR Code redirection service that inserted advertising. Obviously this could've been avoided with many of the existing tools, but the crucial thing seems to be about awareness of the tools.
    • To be clear, the party who chose the 'shady' qr vendor was not the GLAM institution, but rather the WMF affiliate's in house designer. Although the designer is also a Wikimedian, but didn't know where to find the trusted QR generator / didn't aware of the possibility of advertising-hijack.
    • it's not easy to detect which QR generator injected advertising-hijack mechanism between the many choices. Designer wouldn't be aware of it, since initially (for several weeks) the QR works fine, then after several months, it became advertisement. QR scam is not a thing yet, and there's very low awareness.
  • Would the UrlExtension be a good codebase to add QR Code functionality to? Probably not, in T242467 was declined with "You can use some other QR code generator to do this, UrlShortener isn't going to provide it."
  • Add QR Code to Commons' stockphoto gadget? commons:MediaWiki:Gadget-Stockphoto
  • If we use a PHP library (server-side) it'll have to go through security review so will take some months. A JS (frontend) solution would be easier.
Options in the generator
  • Long vs short URLs
  • Option for Permalink vs Nice url (the regular link), including section marker ([[Link#Section])
  • Download button
  • QR Codes can be embellished with images inserted into them. See commons:Category:Embellished quick response codes for examples.
    • Would require an AI to do this.
  • Option to add the project logo (Wikipedia, Wikisource, etc.) in the center of the QR code, doesn't need to be the localized logo, a generic one would be fine.
    • At first, using a WMF logo is fine. We can add other logos next.
  • Could recognize a local file (eg. xx.wikimedia.org/wiki/File:xyz.jpg) and would offer the one from Commons instead (eg. commons.wikimedia.org/wiki/File:xyz.jpg). but if the file is local only, then obviously don't offer that.