This commit is contained in:
Tomas Dvorak
2025-05-29 13:49:34 +02:00
parent 803d30ed5f
commit f9592794e4
+4 -3
View File
@@ -126,9 +126,10 @@
`;
const img = document.createElement('img');
// Fix image path - remove any leading slashes and add the correct base path
const cleanImagePath = bannerImage.replace(/^\/+/, '');
img.src = bannerImage.startsWith('http') ? bannerImage : `/uploads/${cleanImagePath}`;
// Handle image path - use as is if it's an absolute path or URL
img.src = bannerImage.startsWith('http') || bannerImage.startsWith('/')
? bannerImage
: `/uploads/${bannerImage.replace(/^\/+/, '')}`;
img.alt = 'Banner image';
img.style.cssText = `
max-width: 100%;