Skip to content

Displaying SVGs

Olivier Paroz edited this page Sep 28, 2015 · 2 revisions

There are currently two ways to display SVGs in Gallery

Using the SVG provider

You simply add OC\Preview\SVG to your list of enabled providers

'enabledPreviewProviders' =>
 array (
   ...
   5 => 'OC\\Preview\\SVG',
   ...
 ),

Caveats

  • xlink:href attributes are not supported and the preview will be empty if the file contains at list one of them

Notes

  • There may be other preview providers available which offer more features, while keeping you on the safe side

Letting the browser render the SVG

You simply add the following information to your gallery.cnf file, placed in the top folder in your ownCloud.

---
# Gallery configuration file
features:
  ...
  native_svg: yes

Caveats

  • Some complex SVGs can't be parsed
  • SVGs can contain scripts which can attack the browser