- Compatible versions
- 2.2, 2.3
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!) ;
Under Board information, if "Use Full Friendly URLs" (useFriendlyUrls) is set the URL generated is:
Otherwise
Ubuntu (using https://launchpad.net/~ondrej/+archive/ubuntu/php PPA);
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.
Configure Render using proc_open option with;
{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, configure CLI command with;
SVG Template
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:
{{ getSvgUrl('tempate.svg') }}
Code:
/data/svg/<style_id>/<langauge_id>/<style_last_modified>/<templateName.svg>
Code:
svg.php?svg=<templateName>&s=<style_id>&l=<langauge_id>&d=<style_last_modified>
Render to PNG
Rendering SVGs to PNGs requires external support, and depending on OS this may result in odd limitations or poor rendering.php-imagick support
It is not recommended to use Imagick if it can be helped!Ubuntu (using https://launchpad.net/~ondrej/+archive/ubuntu/php PPA);
Code:
sudo apt install php7.4-imagick libmagickcore-6.q16-3-extra
sudo systemctl restart php7.4-fpm
Older versions of Imagick have poor SVG support, on top of Imagick's poor security reputation.
CLI support
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:
<CLI-binary> {destFile} {sourceFile}
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
resvg CLI support
Example using resvg v0.35.0+, configure CLI - Pipe command with;
Code:
/usr/local/bin/resvg --quiet --resources-dir=/tmp/ - -c
Code:
/usr/local/bin/resvg --quiet {sourceFile} {destFile}