Extension:FlickrImporter

From Linux Web Expert

MediaWiki extensions manual
FlickrImporter
Release status: beta
Implementation Parser function , Special page
Description Allows for importing photos from Flickr
Author(s) Sam Wilson (samwilsontalk)
Latest version 0.1.0 (2018-05-03)
MediaWiki 1.30+
PHP 5.5+
Database changes No
Composer samwilson/flickr-importer
License GNU General Public License 3.0 or later
Download
CHANGELOG
  • $wgFlickrImporterKey
  • $wgFlickrImporterSecret
Quarterly downloads Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').
Public wikis using Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').

The FlickrImporter extension allows for importing photos from the social photograph sharing website Flickr.

Installation

  • <translate> Download and place the file(s) in a directory called <tvar name=name>FlickrImporter</tvar> in your <tvar name=ext>extensions/</tvar> folder.</translate>
  • <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
    wfLoadExtension( 'FlickrImporter' );
    $wgFlickrImporterKey = '<key here>';
    $wgFlickrImporterSecret = '<secret here>';
    
  • Register a new app on Flickr: https://www.flickr.com/services/apps/create/
  • Add your new API key and secret to LocalSettings.php
  • File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>

Usage

  1. Log in to MediaWiki, go to your user Preferences page, and click on the 'Misc' section
  2. Click on the 'Connect to Flickr' link, and follow the prompts (you'll be sent to Flickr, asked to authenticate, and then returned to your wiki)
  3. Your Flickr connection will be saved, so you won't have to do this again unless you disconnect
  4. Add your import definitions to User:<Username>/FlickrImporter.json (where <Username> is your username; there's a link to your import page on the Preferences page)

Import definitions are JSON-formatted objects containing the following information:

  1. description: Informative text about this import. Optional.
  2. type: one of: user, group, album, or gallery.
  3. id: ID or username of user; or ID of group, album, or gallery.
  4. privacy: an array of privacy levels (see below). Defaults to 1 just to be safe.
    • 1 public photos (the default)
    • 2 private photos visible to friends
    • 3 private photos visible to family
    • 4 private photos visible to friends & family
    • 5 completely private photos

For example, the complete contents of User:CommonsLover/FlickrImporter.json could be:

[
  {
    "description": "My photos",
    "type": "user",
    "id": "CommonsLover"
  },
  {
    "description": "Wikimedia Commons group",
    "type": "group",
    "id": "30009679@N00"
  }
]

Magic word

This extension adds a new magic word: {{FLICKRID:1234}} that renders as a link to the given photos Flickr page, e.g. <span class="flickr-id">Flickr ID: <a href="https://flic.kr/p/nh">1234</a></span>. The text of the link can be modified via the flickrimporter-flickrid-link system message.

Template

Each photo will be imported and have the following template added to its File page:

{{photo
 | title = 
 | description = 
 | author = 
 | date_taken = 
 | date_taken_granularity = 
 | date_published = 
 | latitude = 
 | longitude = 
 | license = 
 | privacy = 
 | flickr_id = 
}}