Web Analytics Made Easy - StatCounter
Resource icon

xF2 Add-on SVG Template by Xon 2.3.3

No permission to download
  • Reject attempting to save an SVG template with no elements
  • Require Standard Lib by Xon v1.1.0+
  • Force usage of global functions so php can optimize them into special bytecode instead of function calls
  • Fix disabling generating png links if svg => png is not configured
  • Improve installer to report svg => svg conditions which can block usage
  • Use "canonical" URL before XF2.2.3 as "full" doesn't work as expected in all contexts
  • Add basic validation that an SVG template should render correctly
  • Add an optimization pass for SVG's. Prunes pruning whitespace and nodes/attributes known to be safe to remove. Includes minifying any inline css.
  • Support LESS/CSS in SVG's <style> element.
  • Add option "Render SVG's as PNG for mobile devices", this supports rewriting calls to getSvgUrl from .svg to .png
    • Requires NulledTeam - Brower Detection v2.1.0+ add-on
    • Requires updating webserver URL rewrite urls to support PNGs
    • Caching requires explicitly defining a caching context with the name "sv-svg-img" or "css".
    • Supports Imagick or CLI executables as a back-end to render SVGs to PNGs.
      Using Imagick is not recommended
    • Example using resvg, as a CLI-executable back-end;
      /usr/local/bin/resvg --quiet {sourceFile} {destFile}
      This requires compiling using Rust, or use the pre-compiled linux x86_64 binary here.
      Compiling can be done with;
      Code:
      curl https://sh.rustup.rs -sSf | shsource $HOME/.cargo/env
      cargo install resvg
      cp ~/.cargo/bin/resvg /usr/local/bin/resvg
      chmod +x /usr/local/bin/resvg
  • Minor code cleanup, avoid connecting to master redis instance to only connect to a replica instance on rendering cached output
  • Fix that svg templates may not be correctly rendered when friendly URLs are disabled
  • Fix caching non-existent svg templates not returning a 404
  • Do not include a message body, and just return 404 if the template doesn't exist
  • Support Redis Cache saving gzip cached streams to cache system without decoding server side
  • Fix getSvgUrl would generate invalid svg links when viewed by a user who has not explicitly set a style
Extend XF2 router to provide /data/svg support for svg templates.
  • Still recommend webserver rewrite rules if possible
  • If using apache you must adjust the default htaccess rewrite rules provided by XenForo;
    • Add the following;
      Code:
      RewriteRule ^data/svg/([^/]+)/([^/]+)/([^/]+)/([^\.]+).svg$ svg.php?svg=$4&s=$1&l=$2&d=$3 [B,NC,L,QSA]
      before
      Code:
      RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]