Skip to content

Commit a0f3a87

Browse files
committed
Progress.
1 parent 5b7f30f commit a0f3a87

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

zip/samples/cc1p3vtd01v1p0.imscc

18.4 KB
Binary file not shown.

zip/samples/sakai-export.imscc

4.55 MB
Binary file not shown.

zip/views.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ def post(self, request):
3838
data_base64 = data_base64.decode()
3939
htm = '<img src="data:image/jpeg;base64,' + data_base64 + '"><br/>'
4040
piece['html'] = htm
41+
elif fname.endswith('.png') :
42+
piece['type'] = 'png'
43+
data_base64 = base64.b64encode(data) # encode to base64 (bytes)
44+
data_base64 = data_base64.decode()
45+
htm = '<img src="data:image/png;base64,' + data_base64 + '"><br/>'
46+
piece['html'] = htm
47+
elif fname.endswith('.txt') :
48+
piece['type'] = 'txt'
49+
htm = "<pre>\n" + html.escape(data.decode()) + "\n</pre>\n"
50+
piece['html'] = htm
4151
elif fname.endswith('.xml') :
4252
piece['type'] = 'xml'
4353
htm = "<pre>\n" + html.escape(data.decode()) + "\n</pre>\n"

0 commit comments

Comments
 (0)