]> git.aero2k.de Git - sirius.git/commitdiff
More data, more strings, more bytes, more whyyyy
authorJoshua May <notjosh@gmail.com>
Sat, 14 Sep 2019 17:47:50 +0000 (10:47 -0700)
committerJoshua May <notjosh@gmail.com>
Sat, 14 Sep 2019 17:47:50 +0000 (10:47 -0700)
sirius/web/print_key_api.py
sirius/web/printer_print.py
sirius/web/templates/printer_overview.html

index 2a9d6b7307fb27bf04ab408ea5b6fce23afd5827..3e6f12eeff30fb75fdabdbc3ca16fe76b37c5b04 100644 (file)
@@ -91,7 +91,7 @@ def html_for_plain_text(text):
 def html_for_image_data(image_data):
     data_uri = 'data:{type};base64,{data}'.format(
         type=request.content_type,
-        data=base64.b64encode(image_data)
+        data=base64.b64encode(image_data).decode('utf-8')
     )
 
     return '<img src="{uri}" style="width: 100%">'.format(uri=data_uri)
\ No newline at end of file
index a1ae80f36b93e80259cf584c87955b372489107d..5f26f16ac9e2ac1872923484451c8f3aaf4c48f7 100644 (file)
@@ -110,4 +110,4 @@ def preview(user_id, username, printer_id):
 
     stats.inc('printer.preview')
 
-    return '<img style="width: 100%;" src="data:image/png;base64,{}">'.format(base64.b64encode(png.getvalue()))
+    return '<img style="width: 100%;" src="data:image/png;base64,{}">'.format(base64.b64encode(png.getvalue()).decode('utf-8'))
index 58c75615f0672b342656cc5d294e1e0d1f1b8149..e99a67a2f79c8155c182123f397e8d43e00617e3 100644 (file)
 
                {% for m in messages %}
                <div class="thumbnail" style="width: 300px;">
-                       <img src="data:image/png;base64,{{ m.base64_pixels().decode('ascii') }}" style="border: 1px solid #ccc; width: 100%;">
+                       <img src="data:image/png;base64,{{ m.base64_pixels().decode('utf-8') }}" style="border: 1px solid #ccc; width: 100%;">
                        <div class="caption">
                                <p>
                                        {% if m.response_timestamp == None %}