Adopt frontend to take in base64 images

This commit is contained in:
Tim
2025-06-05 10:50:09 +02:00
parent 65cc4ede31
commit 557cff37ab
3 changed files with 10 additions and 8 deletions

View File

@@ -26,11 +26,12 @@ export default function ItemCard({ item }: { item: Item }) {
useEffect(() => {
const fetchImage = async () => {
try {
const response = await fetch(`http://localhost:8085/image?uuid=${item.uuid}`);
const data = await response.json();
if (data.uri) {
setImageUrl(data.uri); // Bild-URL setzen
const response = await fetch(`http://localhost:8085/image?uuid=${item.uuid}`); //image/* as base64
const data = await response.text();
if(data.length == 0) {
console.error("Got emtpy picture for article ", item.uuid);
}
setImageUrl("data:image/jpeg;base64," + data);
} catch (error) {
console.error("Fehler beim Laden des Bildes:", error);
}

View File

@@ -59,10 +59,11 @@ export default function ProductInfo({ item }: { item: Item }) {
const fetchImage = async () => {
try {
const response = await fetch(`http://localhost:8085/image?uuid=${item.uuid}`);
const data = await response.json();
if (data.uri) {
setImageUrl(data.uri); // Bild-URL setzen
const data = await response.text();
if(data.length == 0) {
console.error("Got emtpy picture for article ", item.uuid);
}
setImageUrl("data:image/jpeg;base64," + data);
} catch (error) {
console.error("Fehler beim Laden des Bildes:", error);
}