Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Lifeware
biocham
Commits
551b2101
Commit
551b2101
authored
Feb 17, 2016
by
SOLIMAN Sylvain
Browse files
working for SVG
parent
3473cf87
Changes
1
Hide whitespace changes
Inline
Side-by-side
biocham_kernel/images.py
View file @
551b2101
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment