fix(frontend): add jpeg support

This commit is contained in:
Ruben Fiszel
2022-08-04 01:22:48 +02:00
parent 089f4a7811
commit 1414585141
@@ -6,7 +6,7 @@
export let result: any
let resultKind: 'json' | 'table-col' | 'table-row' | 'png' | 'file' | undefined =
let resultKind: 'json' | 'table-col' | 'table-row' | 'png' | 'file' | 'jpeg' | undefined =
inferResultKind(result)
function isArray(obj: any) {
@@ -45,6 +45,8 @@
return 'table-col'
} else if (keys.length == 1 && keys[0] == 'png') {
return 'png'
} else if (keys.length == 1 && keys[0] == 'jpeg') {
return 'jpeg'
} else if (keys.length == 1 && keys[0] == 'file') {
return 'file'
}
@@ -99,6 +101,14 @@
src="data:image/png;base64,{result.png}"
/>
</div>
{:else if resultKind == 'jpeg'}
<div class="h-full">
Result is an image: <img
alt="jpeg rendered"
class="w-auto h-full"
src="data:image/jpeg;base64,{result.jpeg}"
/>
</div>
{:else if resultKind == 'file'}
<div>
Result is a file: <a