Extension:ImportFreeImages

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual
Crystal Clear action run.png
ImportFreeImages

Release status: unmaintained

Import-free-images-screenshot.png
Implementation Special page
Description Allows users to import properly licensed photos directly into their wiki from flickr.
Author(s) Travis Derouin (Tderouintalk)
Latest version 0.1 (2008-02-17)
MediaWiki 1.11-1.15[1]
License GPL
Download Template:WikimediaDownload/svn
Parameters

$wgIFI_FlickrAPIKey
$wgIFI_CreditsTemplate
$wgIFI_GetOriginal
$wgIFI_PromptForFilename
$wgIFI_ResultsPerPage
$wgIFI_ResultsPerRow
$wgIFI_FlickrLicense
$wgIFI_FlickrSort
$wgIFI_FlickrSearchBy
$wgIFI_AppendRandomNumber
$wgIFI_ThumbType

Translate the ImportFreeImages extension if it is available at translatewiki.net

Check usage and version matrix; code metrics

The ImportFreeImages extension allows users to import properly licensed photos directly into their wiki from flickr.

Update: As of January 17, 2008 this extension should be working with MediaWiki 1.11+. The new version fixes some security issues, so please upgrade if possible. Please e-mail any bug reports to ext@wikihow.com. Thanks.

License[edit | edit source]

Copyright 2006 Travis Derouin, wikiHow

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Author[edit | edit source]

Travis Derouin ( ext @ wikihow.com)

Pre-requisites[edit | edit source]

This extension was tested with MediaWiki 1.8.2. Your PHP configuration must have set allow_url_fopen to On.

Configuration & Installation[edit | edit source]

  • Get the source via SVN
  • You have to have already set up uploads to work properly on your wiki.
  • You may have to manually create the wgTmpDirectory (typically wiki/images/tmp)
  • Download and install phpflickr 2.2 and put it in the directory extensions/ImportFreeImages (so you should have a directory wiki/extensions/ImportFreeImages/phpFlickr-2.2.0).
  • Add this line to your LocalSettings.php
require_once('extensions/ImportFreeImages/ImportFreeImages.php');
$wgEnableUploads = true;
  • Get yourself an API Key from here and set $wgIFI_FlickrAPIKey to this key in ImportFreeImages.php.
  • Find a place where you can link to your new extension Special:ImportFreeImages

Options[edit | edit source]

  • Configure $wgIFI_CreditsTemplate to point to a (possible set of) template that takes the flickr user id, user display name and photo id as parameter. Example:
This photography was imported from flickr. 
This photo was originally taken by [http://www.flickr.com/people/{{{2}}} {{{3}}}] 
and the original photo can be found here: http://www.flickr.com/photos/{{{2}}}/{{{1}}}

This file is licensed under [http://creativecommons.org/licenses/by/2.0/ Creative Commons Attribution 2.0 license].

The license id of the imported image will be appended to the $wgIFI_CreditsTemplate name. So if you are using 'flickr', create a template 'flickr4' for the photos that are imported with the license id 4. See here for all possible license ids.

  • Configure $wgIFI_ResultsPerPage and $wgIFI_ResultsPerRow if you desire.
  • Change which license photos are searched by changing $wgIFI_FlickrLicense, by default it's '4', which is CC Attribution License. Multiple licenses are searchable by using a comma-delimited list (such as '4,5'). See more info here.
  • Change how the results are sorted by altering $wgIFI_FlickrSort, see more here.
  • Change $wgIFI_GetOriginal to true if you want the tool to import the 'original' (or 'large' if original doesn't exist) version of the image, which is most likely the largest version of the image. Otherwise, the 'medium' version by default will be imported.
  • Change $wgIFI_PromptForFilename to true to prompt the user for a destination filename for the photo (using a javascript prompt), use false if you'd prefer just to use the title of the photo as the filename.
  • $wgIFI_FlickrSearchBy can specify whether to search by text or tags. See here for more information on this.
  • $wgIFI_AppendRandomNumber - appends a random to the filename to avoid overwriting existing files. (e.g. specifying a desination filename of Punk may store the file at Punk-1934.jpg)

Possible Errors[edit | edit source]

When you get an error like:

  • "Die hochgeladene Datei ist leer. Der Grund kann ein Tippfehler im Dateinamen sein. Bitte kontrolliere, ob du die Datei wirklich hochladen willst."
  • "The uploaded file is empty. This might be due to a typing error in the file name. Please check whether you upload the file really want."

you have to switch allow_url_fopen to On in you php.ini.

Bugs and enhancements[edit | edit source]

Bugs or feature requests can be sent to the author at ext @ wikihow.com.

Other ideas offering radio buttons and checkboxes to allow users to customize which licenses are searched and how the results are sorted. Other API sources could be added to complement the flickr functionality.

Notes[edit | edit source]

  1. Broken with 1.16