Extension:AControlImageLink

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
OOjs UI icon advanced.svg
AControlImageLink
Release status: beta
Implementation Hook
Description Can prevent inclusion of thumbnails on non-allowed pages
Author(s) Edward Chernenko
Latest version 0.0.1
Compatibility policy release branches
MediaWiki 1.34+
Database changes No
License GNU General Public License 2.0 or later
Download
Translate the AControlImageLink extension if it is available at translatewiki.net
Check usage and version matrix.

With the AControlImageLink extension, you can configure some uploaded image to be includable (via [[File:Name.png|thumb]]) only into the pages where you allow this image to be.

Possible uses:

  1. the image contains spoilers for the movie, and you want to show it only on pages that are marked as "Can contain spoilers" (and have Disclaimers/Warnings). If so, you can allow this image to be included only into these whitelisted pages.
  2. in conjunction with Extension:AccessControl - for some permission tweaks.

How this works:

  1. If File:Something.pdf has <accesscontrol>HasSpoilers</accesscontrol>, then articles without this exactly the same accesscontrol tag won't render [[File:Something.pdf]] syntax. (a link to image description page is shown instead of thumbnail)
  2. Files without accesscontrol tag are not restricted.
  3. Only files with extensions listed in $wgAControlImageLinkRestrictedExtensions array (default: empty) are restricted.

Sample configuration[edit]

wfLoadExtension( 'AControlImageLink' );
$wgAControlImageLinkRestrictedExtensions = [ 'pdf' ];

Installation[edit]

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