Extension:ImagePagePrintLink

From mediawiki.org
MediaWiki extensions manual
Image Page Print Link
Release status: unmaintained
Implementation User interface
Description Adds a link for printing the image at every local image description page.
Author(s) Säsongsmat.nu (Rotseetalk)
Latest version 0.5 (2012-10-30)
MediaWiki 1.18+
PHP 5+
License BSD 3-clause "Modified" License
Download
Example Printable file

The ImagePagePrintLink extension will add a ”print this image” link to the list of links in the top of a image descriptions page. Printing is done using JavaScript, and the link will be visible only if JavaScript is enabled and printing is supported. The link will only show up for local files, as most browsers will not allow JavaScript to print from other domains, and only if the file is a (seemingly) printable image.

This extension was written for Säsongsmat.nu. Please feel free to improve or change anything if you feel you could use it somewhere else.

Installation[edit]

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

To do[edit]

  • Find a better way to handle Google Chrome printing issues in ext.ImagePagePrintLink.core.js. Chrome will close the window immediately, and then try to print an empty page. Therefore, the image page is not closed again if JS detects Chrome. This is an ugly workaround, it would be nice to get rid of it.
  • Use something more accurate than canRender to check if media is image?