Jump to content

Extension:AddImgTag

From mediawiki.org
MediaWiki extensions manual
AddImgTag
Release status: stable
Implementation Hook
Description Provides <img> tag for MediaWiki 1.43 and later versions.
Author(s) awajietalk
Maintainer(s) awajie, Zorua_Fox
Latest version 1.0.0 (2025-09-29)
MediaWiki 1.43+
PHP 7.4+
Database changes No
License GNU General Public License 2.0
Download
README

  • $wgAddImgTagBlacklist
  • $wgAddImgTagBlacklistDomainsList
  • $wgAddImgTagWhitelist
  • $wgAddImgTagWhitelistDomainsList
image, html

The AddImgTag extension allows you to use HTML <img> tags directly in your wiki pages. This restores the <img> tag that was removed in MediaWiki 1.42.

See the README file for detailed instructions on how to install, configure and use this extension.

Usage

[edit]

Simply add the <img> tag to your wiki pages:

<img src="https://example.com/image.jpg" alt="Example image" width="300" height="200" />

Configuration

[edit]

You can control which image sources are allowed or blocked:

  • $wgAddImgTagWhitelist: List of specific URLs that are always allowed.
  • $wgAddImgTagWhitelistDomainsList: List of domains that are always allowed.
  • $wgAddImgTagBlacklist: List of specific URLs that are always blocked.
  • $wgAddImgTagBlacklistDomainsList: List of domains that are always blocked.

Example configuration in LocalSettings.php:

$wgAddImgTagWhitelistDomainsList = [
    'commons.wikimedia.org',
    'upload.wikimedia.org'
];

$wgAddImgTagBlacklistDomainsList = [
    'example.com',
    'untrusted-site.org'
];

See also

[edit]