Extension:ExternalImage

Category:Extensions without an imageCategory:Extensions without a compatibility policyCategory:GPL licensed extensions
MediaWiki extensions manual
ExternalImage
Release status: stableCategory:Stable extensions
Implementation Parser function Category:Parser function extensions
Author(s) Joe (Jgnoonan1961talk)
Latest version 1.0.0 (2024-03-06)
MediaWiki 1.35+Category:Extensions with manual MediaWiki version
License GNU General Public License 2.0 or later
Download Category:Extensions in GitHub version control
Help Help:Extension:ExternalImage
Category:All extensionsCategory:Extensions not in ExtensionJson

Description

The ExternalImage extension adds support for embedding external images in MediaWiki pages with additional functionality for resizing, linking, and alt text support. It provides a simple and secure way to include images from external sources while maintaining control over dimensions and accessibility features. Warning! - Since these are external images, the host may change the image. Please make sure you only link to images that you trust!

Features

  • Embed external images using the <img> tag
  • Support for width and height in both pixels and percentage values
  • Add clickable links to images with optional new tab opening
  • Special handling for SVG images
  • Alt text support for accessibility
  • Secure handling of attributes with HTML escaping

Installation

  1. Download the extension files from: [Your GitHub/Repository URL]
  2. Extract the files into the extensions/ directory of your MediaWiki installation
  3. Add the following line to your LocalSettings.php:
wfLoadExtension( 'ExternalImage' );
  1. Verify you can use the extension by checking Special:Version on your wiki

Usage

Basic Usage

To embed an external image, use the following syntax:

<img src="https://example.com/image.jpg" />

Advanced Usage

The extension supports several optional attributes:

<img 
    src="https://example.com/image.jpg"
    width="500"
    height="300"
    alt="Description of the image"
    href="https://example.com"
    newtab="true"
/>

Parameters

Parameter Required Description Example
src Yes URL of the external image src="https://example.com/image.jpg"
width No Width in pixels or percentage width="500" or width="50%"
height No Height in pixels or percentage height="300" or height="50%"
alt No Alternative text for accessibility alt="Description of the image"
href No URL to link the image to href="https://example.com"
newtab No Open link in new tab if set to "true" newtab="true"

Configuration

This extension requires no additional configuration beyond installation.

Known Issues

  • If only one dimension is provided, the image will scale according to the original aspect ratio.
  • SVG handling includes special width/height attribute handling

Support

For bug reports and feature requests, please visit:

See Also

Category:All extensions Category:Extensions in GitHub version control Category:Extensions not in ExtensionJson Category:Extensions with manual MediaWiki version Category:Extensions without a compatibility policy Category:Extensions without an image Category:GPL licensed extensions Category:Parser function extensions Category:Stable extensions