Extension talk:NativeSvgHandler

About this board

This may be a daft question, but how do I size svg images in Mediawiki pages?

Together with draw.io - does not display text

Summary by Bedtry

Follow the links for a workaround.

Bedtry (talkcontribs)

After saving a file with the draw.io extension it displays all the shapes but no text.

MediaWiki 1.35.8
PHP 7.4.32 (fpm-fcgi)
MySQL 5.7.40
ICU 63.1
Alistair3149 (talkcontribs)

Do you have a live page that I can check?

Bedtry (talkcontribs)
Alistair3149 (talkcontribs)

Looking at the tasks opened with drawioeditor, it seems that the issue is on their end with how the SVG is exported (T271347).

Bedtry (talkcontribs)

It did work with that workaround actually. Both of our links had the same solution in the comments.


Custom SVG image dimensions ignored in Visual Editor

2A03:EC00:B178:D0F4:DD33:41F0:56C8:36FD (talkcontribs)

NativeSvgHandler ignores custom SVG image dimensions set while rendering SVG in Visual Editor. For example, in Visual Editor "File:sample.svg|20x20px" is rendered full-size (200x200), not 20x20. Mediawiki 1.31-1.34.

Alistair3149 (talkcontribs)

It does not ignore custom SVG dimension. It is VE that ignore the size attributes set on the <img> tags. VE is taking the intrinsic size of the SVG. If your original SVG is 200x200px even though you set it is 20x20px in the wiki, VE will ignore the size and render as 200x200px instead.

I'm not familiar enough with VE to work out a fix on it, maybe someone can take a look?

Ciencia Al Poder (talkcontribs)

Ideally this should be in a bugreport (if not already reported), so the relevant team is aware of that, and track the status of the problem.

Daniel K. Schneider (talkcontribs)

Just installed it (MW 1.35.1) and on a Wiki using TinyMCE editor (on a shared hosting)

Wiki code: Display size works fine using the file/image command. Gallery also works, except for the "packed mode" it seems. So it's indeed a VE issue, but not a wiki issue.

TinyMCE Editor: It seems to be able to handle the SVG (including setting the size). However, this editor cannot handle gallery.

Anyhow, thanx for pushing SVG since this extensions allows to display crisp schemas. I need to do some more testing, but for the moment I adopted it :) - Daniel K. Schneider (talk) 17:20, 7 May 2021 (UTC)

Reply to "Custom SVG image dimensions ignored in Visual Editor"

How exactly does this work?

3 (talkcontribs)

Can you just put some svg tags around your svg code and get an image?

Bjsdaiyu (talkcontribs)

I too am curious how this works. I've tried uploading svg files, embedding <svg>...</svg> payloads directly in the source editor and embedding URIs to remotely hosted svg files, all without any success. LocalSettings.php:


$wgFileExtensions[] = 'svg';

Gunnar.offel (talkcontribs)
Reply to "How exactly does this work?"

Support for the link parameter

Summary by Gunnar.offel

works in this revision

Kghbln (talkcontribs)

Nice stuff. Could you add support for the link parameter?

This post was posted by Kghbln, but signed as Tom Edwards.

Agrestis (talkcontribs)


SVG files display well, but the image is not wrapped in a link to the file page. This includes thumbnails in the category view which seriously reduces operability. (talkcontribs)

Version for pre 1.31

Wgkderdicke (talkcontribs)

I am using mediawiki on my local NAS. This NAS is a Synology NAS. Synology provides additional software packages similar to the extensions here. One of this packages is a Mediawiki installation. This works fine, so far. Unfortunately the provided Mediawiki version is still 1.30.0. I do not want to fiddle around with updating this installation because I do not know what will happen, if there comes a regular update by Synology.

But I want to use SVG images. I did not manage to get a SVG rendering software up and running. And since this wiki is only presented locally, my browser can do this job. This software seems to be the extension to make this work. I used an old version of this extension in a first mediawiki attempt on my NAS. That version works. But now this version is not available anymore here. I can only download the lastest version. And that version is fully incompatible with Mediawiki 1.30.0.

Is there a way to get hands on a version that is compatible to 1.30.0? Many thanks for an answer in advance!

Tacsipacsi (talkcontribs)
Alistair3149 (talkcontribs)

@Wgkderdicke Hi there! I created a new branch called legacy for version before 1.31, you can find it both on Gerrit and Github.

Note that the installation for the old version is a bit different, instead of using wfLoadExtension( 'NativeSvgHandler' );, you will need to use require_once "$IP/extensions/NativeSvgHandler/NativeSvgHandler.php"; instead.

Just like @Tacsipacsi mentioned, you should urge Synology to update Mediawiki at least to the latest LTS version (1.31.6) as the 1.30.0 is not in support and it is never a LTS nor the latest version in 1.30 either.

Wgkderdicke (talkcontribs)

Thanks for your answers. I managed to get that old version running. The update issue seems already to be a topic.

Reply to "Version for pre 1.31"
There are no older topics
Return to "NativeSvgHandler" page.