From 8282473657d168e58c8d88f6d1ba07543b9b8340 Mon Sep 17 00:00:00 2001 From: Trit0 Date: Mon, 30 Jun 2025 21:32:08 -0400 Subject: [PATCH] image! --- frontend/src/components/GameCard.vue | 2 +- frontend/src/components/GamePreview.vue | 9 ++++++--- frontend/src/components/LocalImage.vue | 8 +++----- frontend/src/utils/image-manager.ts | 17 +++++++++++++---- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/frontend/src/components/GameCard.vue b/frontend/src/components/GameCard.vue index 1c8f515..e08eadd 100644 --- a/frontend/src/components/GameCard.vue +++ b/frontend/src/components/GameCard.vue @@ -10,7 +10,7 @@ :src="game.ThumbnailPath" class="h-32 w-48 object-cover" :alt="game.Game" - :key="game.Id" + :gameId="game.Id" /> diff --git a/frontend/src/components/GamePreview.vue b/frontend/src/components/GamePreview.vue index bb1205f..3ac3a0e 100644 --- a/frontend/src/components/GamePreview.vue +++ b/frontend/src/components/GamePreview.vue @@ -5,11 +5,13 @@
{{ game.Genres }} - {{ game.Players }} players

{{ game.Description }}

-
- +
@@ -36,6 +38,7 @@ \ No newline at end of file diff --git a/frontend/src/utils/image-manager.ts b/frontend/src/utils/image-manager.ts index aea3939..45c6f12 100644 --- a/frontend/src/utils/image-manager.ts +++ b/frontend/src/utils/image-manager.ts @@ -1,20 +1,29 @@ -import {LoadImage} from "../../wailsjs/go/main/App"; -import * as path from "node:path"; +import { LoadImage } from "../../wailsjs/go/main/App"; export class ImageManager { static Dictionary: {[key: string]: string} = {} public static async getImage(gameId: string, src: string): Promise { - const id = path.join(gameId, src); + const id = gameId + "\\" + src; + console.log(gameId, src, id) if (this.Dictionary[id]) return this.Dictionary[id] const fileBlob = await LoadImage(gameId, src); - const bytes = new Uint8Array(fileBlob.Data); + console.log(fileBlob) + const byteCharacters = atob(fileBlob.Data as any as string); + const byteNumbers = Array.from(byteCharacters).map(c => c.charCodeAt(0)); + console.log(byteCharacters, byteNumbers) + + const bytes = new Uint8Array(byteNumbers); + console.log(bytes) const blob = new Blob([bytes], {type: fileBlob.MimeType }); + console.log(blob) const url = URL.createObjectURL(blob); + console.log(url) this.Dictionary[id] = url + console.log(this.Dictionary) return url; }