OpenRefine/CommonsExtension

Thumbnail previews of media files available on Wikimedia Commons

Closed this issue · 2 comments

Scenario: user wants to use OpenRefine to add structured data to existing files from Wikimedia Commons. They load a series of file paths from Wikimedia Commons and reconcile them with Wikimedia Commons.

We want to give users the option to toggle previews (thumbnails) of the media files, and the option to click the thumbnails to enlarge them. Such preview thumbnails are helpful during editing (e.g. to check if a certain thing is indeed depicted in a file, without having to click on to the file page on Commons).

Wireframes for this feature have been drawn by @lozanaross and OpenRefine/OpenRefine#5154 provides the technical basis for making this feature possible.

Most recent wireframes I found (v4, development version):

image

Since we are building an extension point for this (OpenRefine/OpenRefine#5154), this will be part of the Commons extension, so moving this issue there.

The above PR (#88) is getting there, but it misses support for thumbnails of files with some form of capitalization in the file extension.

All supported file extensions for Wikimedia Commons are listed at https://commons.wikimedia.org/wiki/Special:MediaStatistics - it's important to take into account that variations in upper/lower case can happen in these file extensions. We have many thousands of .JPG files, quite a few .TIF, also a few .Jpg and many other variants.
Other resources to check:

To test an update to the PR, here's an OpenRefine project with a mix of file extensions:
Wikimedia-Commons-files-for-various-tests.openrefine.tar.gz
For now, in this project, I'd expect thumbnails to show up for files that are pretty straightforward 'image based' formats, including tiff files, pdfs, and also videos. Audio files and 3D files (e.g. .stl extension) probably less so.

And here's the source for that project; a list of all the varied wonky sorts of file extensions that are around on Wikimedia Commons: https://etherpad.wikimedia.org/p/Various_Commons_files_for_testing

A last piece of feedback from User:Nikki via the OpenRefine-Wikimedia Telegram channel:

It seems thumb.php needs extra parameters for tiffs, https://commons.wikimedia.org/w/thumb.php?f=Ebola_Virus_-_Electron_Micrograph.tiff&w=320&h=320 doesn't work but https://commons.wikimedia.org/w/thumb.php?f=Ebola_Virus_-_Electron_Micrograph.tiff&w=320&h=320&lossy=lossy&page=1
does. it might make more sense to use Special:Filepath which redirects to the right url for the image/thumbnail, e.g. https://commons.wikimedia.org/wiki/Special:Filepath/Ebola_Virus_-_Electron_Micrograph.tiff?width=320&height=320