Skip to content

Commit

Permalink
Fixing svg processors
Browse files Browse the repository at this point in the history
  • Loading branch information
superalex committed Mar 17, 2017
1 parent 282b964 commit a726f28
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion taiga/base/utils/thumbnails.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,16 @@
try:
from cairosvg.surface import PNGSurface

def _accept(prefix):
return "svg" in str(prefix.lower())

def svg_image_factory(data, *args):
png_data = PNGSurface.convert(data.read())
return PngImageFile(BytesIO(png_data))

Image.register_mime("SVG", "image/svg+xml")
Image.register_extension("SVG", ".svg")
Image.register_open("SVG", svg_image_factory)
Image.register_open("SVG", svg_image_factory, _accept)
except Exception:
pass

Expand Down

0 comments on commit a726f28

Please sign in to comment.