OpenRefine / CommonsExtension

An OpenRefine extension that helps with Wikimedia Commons editing: start projects from Wikimedia Commons categories; Commons-specific GREL functions.
BSD 3-Clause "New" or "Revised" License
14 stars 9 forks source link

Improvements to Wikimedia Commons file thumbnail previews #91

Closed trnstlntk closed 1 year ago

trnstlntk commented 1 year ago

In #58 basic support for Wikimedia Commons file thumbnails has been added. However, I have overlooked a bug while testing that first PR, and there are some further improvements which can make the thumbnail support better:

Capital letters in file extensions not yet supported

We still miss 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

Support for better thumbnails of tiff files

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

trnstlntk commented 1 year ago

Capitalization issue has been addressed.