Extension talk:NativeSvgHandler

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

The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.


Nice stuff. Could you add support for the link parameter? --Tom Edwards (talk) 21:32, 18 June 2012 (UTC) 14:54, 12 September 2013 (UTC)

Seconded.
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. Agrestis (talk) 06:42, 26 April 2014 (UTC)
I had this same problem, so I hacked the code quickly: added link wrapper, copied from base MediaTransformOutput class, https://doc.wikimedia.org/mediawiki-core/master/php/html/MediaTransformOutput_8php_source.html
I've submitted a pull request, but in the meantime, interested parties can get my copy from https://github.com/kvand/NativeSvgHandler. 69.165.234.140 01:10, 27 August 2014 (UTC)
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

How exactly does this work?

Can you just put some svg tags around your svg code and get an image? 72.37.244.100 11:28, 20 August 2014 (UTC)

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:
wfLoadExtension('NativeSvgHandler');
$wgFileExtensions[] = 'svg'; Bjsdaiyu (talk) 22:05, 2 November 2020 (UTC)
Since it is a file handler you need to upload the SVG File. The Handler skips the JPG/PNG-thumbnail-process and delivers instead the SVG in a direct way.
For inline SVG was another extension ..
https://www.mediawiki.org/w/index.php?title=Extension:Inline_SVG_extension&oldid=2490064
it's unmaintained and was sweeped. Gunnar.offel (talk) 18:03, 28 January 2021 (UTC)

Version for pre 1.31

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! Wgkderdicke (talk) 05:38, 1 March 2020 (UTC)

First of all, you should urge Synology to update MediaWiki, as MW 1.30 reached end of life nine months ago, and it wasn’t even an LTS version (see Version lifecycle). If it’s impossible, https://github.com/wikimedia/mediawiki-extensions-NativeSvgHandler/tree/df0a5b903f seems to be a pre-1.31 version (a way pre-1.31 one: its last commit was before the release of MW 1.27). You can download it using the “Clone or download” button. Tacsipacsi (talk) 13:32, 1 March 2020 (UTC)
@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. Alistair3149 (talk) 10:23, 2 March 2020 (UTC)
Thanks for your answers. I managed to get that old version running. The update issue seems already to be a topic. Wgkderdicke (talk) 15:27, 3 March 2020 (UTC)

Custom SVG image dimensions ignored in Visual Editor

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. 2A03:EC00:B178:D0F4:DD33:41F0:56C8:36FD (talk) 20:13, 25 February 2021 (UTC)

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? Alistair3149 (talk) 21:26, 13 March 2021 (UTC)
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. Ciencia Al Poder (talk) 15:27, 15 March 2021 (UTC)
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)

Together with draw.io - does not display text

The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.


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
Bedtry (talk) 13:22, 15 November 2022 (UTC)
Do you have a live page that I can check? Alistair3149 (talk) 17:01, 15 November 2022 (UTC)
I dont, its a private wiki..
But apparently there has been this issue. Have not really read into it
https://phabricator.wikimedia.org/tag/mediawiki-extensions-drawioeditor/ Bedtry (talk) 18:54, 15 November 2022 (UTC)
Looking at the tasks opened with drawioeditor, it seems that the issue is on their end with how the SVG is exported (T271347). Alistair3149 (talk) 00:59, 16 November 2022 (UTC)
It did work with that workaround actually. Both of our links had the same solution in the comments.
Thanks Bedtry (talk) 15:42, 16 November 2022 (UTC)
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

How do I use this?

I installed the extension and it says it is installed. What do I do now? 4.8.13.234 (talk) 16:56, 29 September 2023 (UTC)

Nothing, it should already be working. You can confirm this by checking if any image embed of an SVG image is itself an SVG. ディノ千?!☎ Dinoguy1000 18:38, 29 September 2023 (UTC)