Commit 551b2101 authored by SOLIMAN Sylvain's avatar SOLIMAN Sylvain
Browse files

working for SVG

parent 3473cf87
......@@ -12,9 +12,14 @@ def display_data_for_image(filename):
image_type = imghdr.what(None, image)
if image_type is None:
raise ValueError("Not a valid image: %s" % image)
if filename.endswith('.svg'):
image_type = 'svg+xml'
image_data = image.decode('utf-8')
else:
raise ValueError("Not a valid image: %s" % image)
else:
image_data = base64.b64encode(image).decode('ascii')
image_data = base64.b64encode(image).decode('ascii')
content = {
'data': {
'image/' + image_type: image_data
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment