Extension:ExternalImage
Release status: stable |
|
|---|---|
| Implementation | Parser function |
| Author(s) | Joe (Jgnoonan1961talk) |
| Latest version | 1.0.0 (2024-03-06) |
| MediaWiki | 1.35+ |
| License | GNU General Public License 2.0 or later |
| Download | GitHub: Note: |
| Help | Help:Extension:ExternalImage |
Description
[edit]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
[edit]- 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
[edit]- Download the extension files from: [Your GitHub/Repository URL]
- Extract the files into the
extensions/directory of your MediaWiki installation - Add the following line to your
LocalSettings.php:
wfLoadExtension( 'ExternalImage' );
- Verify you can use the extension by checking Special:Version on your wiki
Usage
[edit]Basic Usage
[edit]To embed an external image, use the following syntax:
<img src="https://example.com/image.jpg" />
Advanced Usage
[edit]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
[edit]| 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
[edit]This extension requires no additional configuration beyond installation.
Known Issues
[edit]- 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
[edit]For bug reports and feature requests, please visit:
See Also
- ExternalImage Help - User documentation
