mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 04:56:00 +00:00
36 lines
717 B
Svelte
36 lines
717 B
Svelte
<script lang="ts">
|
|
import _ from 'lodash';
|
|
import ErrorInfo from '../elements/ErrorInfo.svelte';
|
|
|
|
export let selection;
|
|
|
|
function extractPicture(values) {
|
|
const value = values;
|
|
if (value?.type == 'Buffer' && _.isArray(value?.data)) {
|
|
return 'data:image/png;base64, ' + btoa(String.fromCharCode.apply(null, value?.data));
|
|
}
|
|
return null;
|
|
}
|
|
|
|
$: picture = extractPicture(selection[0]?.value);
|
|
</script>
|
|
|
|
{#if picture}
|
|
<div class="wrapper">
|
|
<img src={picture} />
|
|
</div>
|
|
{:else}
|
|
<ErrorInfo message="Error showing picture" alignTop />
|
|
{/if}
|
|
|
|
<style>
|
|
.wrapper {
|
|
overflow: auto;
|
|
/* position: absolute;
|
|
left: 0;
|
|
top: 0;
|
|
right: 0;
|
|
bottom: 0; */
|
|
}
|
|
</style>
|