Last modified on 27 May 2014, at 20:30

User:HYanWong

Automatic credit (attribution) linesEdit

The following code generates credit lines for images on Commons (a bit like Gadget-Stockphoto but designed for batch processing large numbers of images).

You give the script a list of image names, or a search pattern, and it slurps through the entire commons-pages-articles xml dump looking for matching pages, tries to recognise authors from those pages, then grabs the licences by looking through a (parsed) copy of the commonswiki categorylinks sql table.

You first need to download the sql file, unzip it, and run this simple C program to pre-parse it into a text-readable form. You can then download and unpack the commons xml dump, and run my script from the command line, something like

./imagenames2credits.pl list_of_images.txt commonswiki-latest-pages-articles.xml commonswiki-latest-categorylinks.sql outputCreditLines.txt

The perl script is available at User:HYanWong/imagenames2credits.pl.

TestEdit

Note: This information is taken from [[:{{subst:FULLPAGENAME}}]]