diff options
Diffstat (limited to 'mammoth/images.py')
| -rw-r--r-- | mammoth/images.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/mammoth/images.py b/mammoth/images.py index 21b9288..1623a73 100644 --- a/mammoth/images.py +++ b/mammoth/images.py @@ -1,4 +1,5 @@ import base64 +import re from . import html @@ -26,3 +27,11 @@ def data_uri(image): return { "src": "data:{0};base64,{1}".format(image.content_type, encoded_src) } + + +def image_filename_extension(image): + result = re.split(r"/|\\", image.content_type) + if len(result) < 2: + return None + else: + return result[1] |
