about summary refs log tree commit diff
path: root/MatrixUtils.Web/wwwroot/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'MatrixUtils.Web/wwwroot/index.html')
-rw-r--r--MatrixUtils.Web/wwwroot/index.html16
1 files changed, 16 insertions, 0 deletions
diff --git a/MatrixUtils.Web/wwwroot/index.html b/MatrixUtils.Web/wwwroot/index.html
index 5182193..7425de2 100644
--- a/MatrixUtils.Web/wwwroot/index.html
+++ b/MatrixUtils.Web/wwwroot/index.html
@@ -57,6 +57,22 @@
                     height: window.innerHeight
                 };
             }
+
+            setImageStream = async (element, imageStream) => {
+                if(!(element instanceof HTMLElement)) {
+                    console.error("Element is not an HTMLElement", element);
+                    return;
+                }
+                
+                const arrayBuffer = await imageStream.arrayBuffer();
+                const blob = new Blob([arrayBuffer]);
+                const url = URL.createObjectURL(blob);
+                const image = document.getElementById(imageElementId);
+                image.onload = () => {
+                    URL.revokeObjectURL(url);
+                }
+                image.src = url;
+            }
         </script>
         <script src="_framework/blazor.webassembly.js"></script>
 <!--        <script>navigator.serviceWorker.register('service-worker.js');</script>-->