TeamDGT

Registrations are currently open (for some short Time)!

DGT Girl

[XF Addon] Svg Template by Xon 2.6.1

No permission to download
Compatible Versions:
2.2, 2.3
Additional Requirements:
php 7.2+
Standard Library by Xon v1.20.0+ (free)
If installed: Redis Cache addon v2.17.0+
Visible Branding:
No
Depending on configuration, this add-on requires webserver URL rewrite support!

Depending on configuration, this add-on requires webserver URL rewrite support!

Allows SVG (Scalable Vector Graphics) images to be stored as templates. This creates a new svg.php file in the XF root directory.

To generate a link to an SVG template (The template must have .svg at the end of the name!) ;

Code:
You must log in to view
(1 lines)

Under Board information, if "Use Full Friendly URLs" (useFriendlyUrls) is set the URL generated is:

Code:
You must log in to view
(1 lines)

Otherwise

Code:
You must log in to view
(1 lines)

Render to PNG​

Rendering SVGs to PNGs requires external support, and depending on OS this may result in odd limitations or poor rendering.

It is not recommended to use Imagick if it can be helped!

Ubuntu (using launchpad.net PPA);

Code:
You must log in to view
(2 lines)

Note; some distro's require libmagickcore-6.q16-3-extra to be installed to enable SVG support.

Older versions of Imagick have poor SVG support, on top of Imagick's poor security reputation.

This is a generic escape hatch to plug in arbitrary png conversion, using proc_open in php.

Configure Render using proc_open option with;

Code:
You must log in to view
(1 lines)

{sourceFile} is the source SVG written as a temp file {destFile} is the destination PNG file as a temp file

Alternatively input/output can be done via pipes

Note; template names are only alpha-numeric strings, which is enforced by validation before the CLI option is called

Example using resvg v0.35.0+, configure CLI - Pipe command with;

Code:
You must log in to view
(1 lines)

Example using resvg, configure CLI command with;

Code:
You must log in to view
(1 lines)

Precompiled binary​

Pre-compiled linux x86_64 binary has been made available here. Compiled on CentOS 7, works on Ubuntu 18.04/20.04/22.04

Compiling may bind to newer versions of glibc which can cause portability issues

Code:
You must log in to view
(5 lines)

Inkscape CLI support​

Note; use snap as otherwise it is likely to have too old an instance!

Code:
You must log in to view
(1 lines)

Configure CLI PIPE command with;

Code:
You must log in to view
(1 lines)

Features​

An example of conditional CSS to use the png over the svg for mobile clients

LESS:
You must log in to view
(17 lines)

Explicit usage in templates;

XML:
You must log in to view
(9 lines)

XenForo 2 routing integration​

While webserver rewrite rules are recommended, this add-on supports extending XenForo's routing system to provide zero-configuration support for SVG Templates

Nginx URL rewrite config​


Code:
You must log in to view
(5 lines)

Apache URL rewrite config​

Add the rule before the final index.php;

Code:
You must log in to view
(1 lines)

ie, should look similar to;

Code:
You must log in to view
(13 lines)

Latest updates

  1. 2.6.1 - Bugfix update

    Fix XF2.3 style variations support for getSvgUrl() in style properties
Back
Top