Extension:FlickrAPI

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
Crystal Clear action run.svg
FlickrAPI
Release status: stable
Implementation Tag
Description Embeds Flickr images
Author(s) Ike Hecht (Tosfostalk)
Latest version 2.0.0 (August 2017(2017-08))
MediaWiki 1.25+
PHP 5.4+
Database changes No
License GNU General Public License 2.0 or later
Download
Parameters
$wgFlickrAPIKey, $wgFlickrAPISecret, $wgFlickrAPIDefaults
Hooks used
ParserFirstCallInit
Translate the FlickrAPI extension if it is available at translatewiki.net
Check usage and version matrix.

The FlickrAPI allows you to embed Flickr images into your wiki. It is intended as a replacement for Extension:Flickr and is mostly backwards-compatible, but note that the configuration variables have changed. It uses the phpFlickr library.

Installation[edit]

  • Download and place the file(s) in a directory called FlickrAPI in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    wfLoadExtension( 'FlickrAPI' );
    $wgFlickrAPIKey = ' /*FLICKR API KEY HERE*/ ';
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Note Note: You'll need an API key from Flickr. Get it here.

When installing from Git, please note that this extension requires Composer.

So, after installation from git, add the line "extensions/FlickrAPI/composer.json" to the "composer.local.json" file in the root directory of your wiki like e.g.

{
	"extra": {
		"merge-plugin": {
			"include": [
				"extensions/FlickrAPI/composer.json"
			]
		}
	}
}

Now run composer update --no-dev from the top level of your MediaWiki installation.

Configuration parameters[edit]

  • $wgFlickrAPIKey - Required. Your Flickr API key goes here.
  • $wgFlickrAPISecret - The API secret from Flickr. This is optional and right now it probably doesn't do anything.
  • $wgFlickrAPIDefaults - Array that contains the default values for the extension for when the <flickr> call does not specify certain options. Defaults to: [ 'type' => 'frameless', 'location' => 'right', 'size' => '-' ];

Usage[edit]

Embed a Flickr image using the tag: <flickr>id|type|location|size|caption</flickr>

The only mandatory parameter is id. The others can be omitted and the defaults will be applied from $wgFlickrAPIDefaults.

id
The Flickr ID of this photo.
type
The display type. This can be set to: thumb, frame or frameless.
location
The horizontal alignment. This can be set to: right, left, center or none.
size
The size to use for the image. This can be set to: s, t, m, - or b. See this page for more info.
caption
The caption to display for the image. If omitted, the default caption will be the photo's title in Flickr. Note that no caption is ever displayed if type is set to frameless.